The Hours, Min, Sec print OK, but the time will not. R4 RTC. I was trying to use double digits for numbers less than 10 but I'll settle for single digits.
What is the time that you're referring to? I only see the printing of hours, minutes and seconds. Are you saying that it only prints those numbers after a second upload?
Thanks sterretje. Well, I mistakenly said 'time' and not 'date' will not display. But yes, the first upload does nothing. I click upload again and it runs fine. Every-time, it takes 2 clicks.
I know that date portion of the code will not compile, but why? It would help if you posted a solution, as I'm new to this stuff. That's why it's commented out.
Here's the error msg if I remove the commented out block:
C:\Users\16508\Documents\Arduino\OLED_LST_128x32\OLED_LST_128x32.ino: In function 'void loop()':
C:\Users\16508\Documents\Arduino\OLED_LST_128x32\OLED_LST_128x32.ino:77:39: error: no matching function for call to 'Adafruit_SSD1306::print(Month)'
display.print(currentTime.getMonth());
^
In file included from C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/ArduinoAPI.h:31:0,
from C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/Arduino.h:4,
from C:\Users\16508\AppData\Local\arduino\sketches\2EF8EEC2E3EAD90D4E0F6D3AF7E4EB9C\sketch\OLED_LST_128x32.ino.cpp:1:
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:64:12: note: candidate: size_t arduino::Print::print(const arduino::__FlashStringHelper*)
size_t print(const __FlashStringHelper *);
^~~~~
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:64:12: note: no known conversion for argument 1 from 'Month' to 'const arduino::__FlashStringHelper*'
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:65:12: note: candidate: size_t arduino::Print::print(const arduino::String&)
size_t print(const String &);
^~~~~
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:65:12: note: no known conversion for argument 1 from 'Month' to 'const arduino::String&'
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:66:12: note: candidate: size_t arduino::Print::print(const char*)
size_t print(const char[]);
^~~~~
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:66:12: note: no known conversion for argument 1 from 'Month' to 'const char*'
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:67:12: note: candidate: size_t arduino::Print::print(char)
size_t print(char);
^~~~~
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:67:12: note: no known conversion for argument 1 from 'Month' to 'char'
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:68:12: note: candidate: size_t arduino::Print::print(unsigned char, int)
size_t print(unsigned char, int = DEC);
^~~~~
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:68:12: note: no known conversion for argument 1 from 'Month' to 'unsigned char'
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:69:12: note: candidate: size_t arduino::Print::print(int, int)
size_t print(int, int = DEC);
^~~~~
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:69:12: note: no known conversion for argument 1 from 'Month' to 'int'
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:70:12: note: candidate: size_t arduino::Print::print(unsigned int, int)
size_t print(unsigned int, int = DEC);
^~~~~
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:70:12: note: no known conversion for argument 1 from 'Month' to 'unsigned int'
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:71:12: note: candidate: size_t arduino::Print::print(long int, int)
size_t print(long, int = DEC);
^~~~~
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:71:12: note: no known conversion for argument 1 from 'Month' to 'long int'
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:72:12: note: candidate: size_t arduino::Print::print(long unsigned int, int)
size_t print(unsigned long, int = DEC);
^~~~~
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:72:12: note: no known conversion for argument 1 from 'Month' to 'long unsigned int'
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:73:12: note: candidate: size_t arduino::Print::print(long long int, int)
size_t print(long long, int = DEC);
^~~~~
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:73:12: note: no known conversion for argument 1 from 'Month' to 'long long int'
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:74:12: note: candidate: size_t arduino::Print::print(long long unsigned int, int)
size_t print(unsigned long long, int = DEC);
^~~~~
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:74:12: note: no known conversion for argument 1 from 'Month' to 'long long unsigned int'
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:75:12: note: candidate: size_t arduino::Print::print(double, int)
size_t print(double, int = 2);
^~~~~
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:75:12: note: no known conversion for argument 1 from 'Month' to 'double'
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:76:12: note: candidate: size_t arduino::Print::print(const arduino::Printable&)
size_t print(const Printable&);
^~~~~
C:\Users\16508\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.3.2\cores\arduino/api/Print.h:76:12: note: no known conversion for argument 1 from 'Month' to 'const arduino::Printable&'
exit status 1
Compilation error: no matching function for call to 'Adafruit_SSD1306::print(Month)'
getHour() etc is a function and you can not assign a value to a function. Further combining text ("0") and numbers does not work.
The simplest way to solve leading zeroes
if (currentTime.getHour() < 10)
{
display.print("0");
}
display.print(currentTime.getHour());
display.print(":");
If you want a leading zero for the month, see the earlier comment about the casting.
I don't have an Uno R4 Minima so I can not test the behaviour. What happens when you close the serial monitor, upload a sketch and next open the serial monitor? Is the behaviour the same?