destroyedlolo / OWBus

Maxim's One Wire bus handling for arduino
Other
4 stars 3 forks source link

Arduino UNO and serial monitor hangs. #3

Open rajchips opened 5 years ago

rajchips commented 5 years ago

Hi,

It's working now... Library examples are not correct. All probe assignment should be before "void setup(){" See below for correct code...

//#include

include

include <OWBus/DS18B20.h>

include <OWBus/DS2413.h>

define ONE_WIRE_BUS 7 // Where 1W bus is connected to

OneWire oneWire(ONE_WIRE_BUS); // Initialize oneWire library OWBus bus(&oneWire); int count;

DS18B20 probe(bus, 0x282503E00200000B); DS2413 led(bus, 0x3A34074E0000000A); DS2413 fan2(bus, 0x3AF3E64D0000008F);

void setup() { Serial.begin(9600); delay(100); count=1; }

void loop() { //Serial.println(probe.getTemperature());

if (probe.getTemperature()>=29){ led.setPIOA( false ); led.setPIOB( false ); fan2.setPIOB( true ); }

else{ led.setPIOA( true ); led.setPIOB( true ); fan2.setPIOB( false ); }

//Serial.println(fan2.readPIOs()); //Serial.println(fan2.getPIOB());

delay(500);

//count++; //Serial.println(count);

bt_upload();

}

destroyedlolo commented 5 years ago

Hi, sorry for this late issue (I was busy by other stuffs that leave me away from git :) ).

Do you means it's hanging at the printf line ? If so, I think there is something broken in Serial code as I got the same issue with OneWireArduino lib and it seems something wrong about interruption management in Serial vs other stuffs.

Can you please try with only 1 probe ?

rajchips commented 5 years ago

Hi,

Arduino UNO hangs around 138 print loops with 3 probes attached. Arduino Mega256 hangs around 690 print loops with 3 probes attached.

Arduino UNO hangs around 146 print loops with single probe DS18B20( however 3 device attached to bus).

Arduino UNO, printing no probe DS18B20 then no hangs( however 3 device attached to bus)...

I can do further testing for you if needed, please let me know.

I have about 20 DS18b20 and 25 DS2413.

Thanks, Raj

http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avg.com http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Sat, Dec 22, 2018 at 1:26 PM destroyedlolo notifications@github.com wrote:

Hi, sorry for this late issue (I was busy by other stuffs that leave me away from git :) ).

Do you means it's hanging at the printf line ? If so, I think there is something broken in Serial code as I got the same issue with OneWireArduino lib and it seems something wrong about interruption management in Serial vs other stuffs.

Can you please try with only 1 probe ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/destroyedlolo/OWBus/issues/3#issuecomment-449589359, or mute the thread https://github.com/notifications/unsubscribe-auth/AIUwWxUlrwtVeYHxMkVKMlUefGnRbVecks5u7nk8gaJpZM4ZQ44j .

destroyedlolo commented 5 years ago

Ok, so I think there is a memory leak somewhere every time an object is created. I didn't noticed it as I'm mostly using DeepSleep on my ESP which cause a full restart at every wakeup. I'll investigate. Thanks for the report.

In addition, Arduinos have a very small memory so creating stack objects is probably not a good idea as well.