I'm an Arduino n00b but not an absolute beginner.
The issue is that I can have this code running for days or sometimes just hours.
I've attached it as mainCodelisting which I've run this on the Arduino Uno with no issues. Then I switched to just the atmega328p. I've attached the schematic.
The power to it is coming off of another Arduino connected to the PC USB which I've read will give at a minimum 500mA.
The AltSoftSerial is to send the temperatures to another microcontroller, and the hardware serial to debug on the PC.
I'm using 3 instances of the OneWire library since getting them all (several meters away) to report one one pin has been a nightmare, so I made the code as it is to see if I can get 4 DS28EA00U probes to work on 3 pins.
I'm just wondering if I'm having any sort of Memory leak.
In another variant, used a character array since everyone that mentions String is instantly pelted with rotten vegetables. I've attached that as charArrayCnippet.
To be able to use printf with floats I followed some tutorial that said to edit boards.txt and add this
diecimila.menu.printf.default=Default printf
diecimila.menu.printf.default.compiler.c.elf.extra_flags=
diecimila.menu.printf.full=Full printf
diecimila.menu.printf.full.compiler.c.elf.extra_flags=-Wl,-u,vfprintf -lprintf_flt
diecimila.menu.printf.minimal=Minimal printf
diecimila.menu.printf.minimal.compiler.c.elf.extra_flags=-Wl,-u,vfprintf -lprintf_min
One last thing I've tried is to print free memory using
#ifdef __arm__
// should use uinstd.h to define sbrk but Due causes a conflict
extern "C" char* sbrk(int incr);
#else // __ARM__
extern char *__brkval;
#endif // __arm__
int freeMemory() {
char top;
#ifdef __arm__
return &top - reinterpret_cast<char*>(sbrk(0));
#elif defined(CORE_TEENSY) || (ARDUINO > 103 && ARDUINO != 151)
return &top - __brkval;
#else // __arm__
return __brkval ? &top - __brkval : &top - __malloc_heap_start;
#endif // __arm__
}
Then I would print out the free memory before and after the calls processOneWire.
In both instances I didn't see any dramatic decline in free memory.
I've ordered an Atmel JTAGICE, but it won't be here for some time.
Any help is appreciated.
mainCodelisting.ino (4.9 KB)
charArraySnippet.cpp (719 Bytes)
