I have a problem with RTC, because it doesn't work correctly. When I try read date or time, I see only characters "àààààààà" or or the program is blocked.
#include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #include <RTClib.h> DS1307 rtc; DateTime rtcTime; void setup() { //zainicjowanie generatora liczb losowych randomSeed(A0); Wire.begin(); rtc.begin(); } void loop() { rtcTime = rtc.now(); int mm = rtcTime.minute(); Serial.println(mm); delay(500); } This function blocked my program:
String timeRTC(){ DateTime now = rtc.now(); String Hour = "0" + String(now.hour()); String Minutes = "0" + String(now.minute()); String Seconds = "0" + String(now.second()); if(Hour.length() == 3){ Hour = Hour.substring(1); } if(Minutes.length() == 3){ Minutes = Minutes.substring(1); } if(Seconds.length() == 3){ Seconds = Seconds.substring(1); } return Hour+":"+Minutes+":"+Seconds; } I can't find what is causing this problem. I use Arduino UNO in WOKWI Emulator.
