#include #include #include #include #include //Ustawić zegar w setup czy nie? boolean SETUP=false; LiquidCrystal lcd (12,11,10,9,8,7); void setup() { Serial.begin(9600); lcd.begin(16,2); if (SETUP) { RTC.stop(); RTC.set(DS1307_SEC,1); //set the seconds RTC.set(DS1307_MIN,49); //set the minutes RTC.set(DS1307_HR,19); //set the hours RTC.set(DS1307_DOW,6); //set the day of the week RTC.set(DS1307_DATE,1); //set the date RTC.set(DS1307_MTH,5); //set the month RTC.set(DS1307_YR,10); //set the year RTC.start(); } } char time [20]; char date [20]; void getTime(char *t, char *d) { sprintf(t,"%.2i:%.2i:%.2i", RTC.get(DS1307_HR, true), RTC.get(DS1307_MIN, false), RTC.get(DS1307_SEC, false) ); sprintf(d, "%i/%i/%i", RTC.get(DS1307_DATE, false), RTC.get(DS1307_MTH, false), RTC.get(DS1307_YR, false) ); } void loop() { getTime(time, date); Serial.println(time); lcd.setCursor(0,0); lcd.print(time); lcd.setCursor(0,1); lcd.print(date); delay(1000); }