Kod:
#include <DS1307RTC.h>
String showtime;
String czas;
void setup() {
Serial.begin(9600); // the SERIAL baud rate
delay(5000);
gettime();
delay(100);
Serial.println(showtime);
}
void gettime(){
tmElements_t tm;
showtime = " ";
if (RTC.read(tm)){
showtime = "Czas: ";
showtime += tmYearToCalendar(tm.Year);
showtime += "/";
showtime += tm.Month;
showtime += "/";
showtime += tm.Day;
showtime += ", ";
showtime += tm.Hour;
showtime += ":";
showtime += tm.Minute;
showtime += ":";
showtime += tm.Second;
showtime += " .";
}
else {
if (RTC.chipPresent()) {
showtime = "The DS1307 is stopped. Please run the SetTime";
} else {
showtime = "DS1307 read error! Please check the circuitry.";
}
}
showtime = "blad RTC!";
}