I have a fairly mature sketch for an Arduino with
(1) DS1307 RTC
(2) SSD1306 OLED
(3) Dallas temperaure sensor.
When I load it into a UNO R3. The sketch compiles but the code locks up mid stream . If I strip code until it comples to
< 22,200 bytes program space
< 840 bytes dynamic memory
I can run 1 & 2 together, or 2 & 3, but not all three at once.
The sketch has run on a MEGA no problem. So I'm pretty sure I have a memory overflow problem due to UNO R3 limitations.
I'm looking for tools/clues to help diagnose what is happening in RAM. From my dim dark Arduino memory I vaguely recall there is a way to measure & report (or log at least) dynamic memory usage while a sketch is running. e.g. heap, stack size?
I have 3 sketches that work fine on UNO R3 not on R4 ( both WiFi & Minima)
RTC master uses DS1307RTC library
OTEXT_master uses SSD1306Ascii
TinyRTC combines 1 + 2 into a visible clock
For all these the RTC reports nothing and the OLED stays blank on R4
So I reverted to the really basic ReadTest provided with DS1307RTC library and it also cannot communicate to R4, telling me to check the circuit.
(In all tests I'm swapping in same RTC/OLED hardware & wiring)
It seems both SSD1306Ascii and DS1307RTC libs don't support I2C properly on (my) R4's ???
Think I may have found the problem. The DS1307RTC library calls Wire.begin() in the constructor, commenting this out in the library and calling Wire.begin() at the start of setup() appears to work.
I'm not having any problem with a simple test of SSD1306Ascii using hardware I2C.