// Sett dataog tid manuelt ved bruk av DS3231 RTC tilkoblet I2C og Wire biblioteket #include #include "Sodaq_DS3231.h" char weekDay[][5] = {"Søn", "Man", "Tirs", "Ons", "Tors", "Fre", "Lør" }; //År, Måned, Dato, Time, Minutt, Sekund og ukedag(gårr fra 0 til 6) DateTime dt(2022, 07, 31, 20, 33, 45, 0); void setup () { Serial.begin(57600); Wire.begin(); rtc.begin(); rtc.setDateTime(dt); //Registrer tiden i DS3132 } void loop () { // Skriv ut tiden i monitoren DateTime now = rtc.now(); //Henten tiden Serial.print(now.year(), DEC); Serial.print('-'); Serial.print(weekDay[now.dayOfWeek()]); Serial.print("dag "); Serial.print(now.date(), DEC); Serial.print('/'); Serial.print(now.month(), DEC); Serial.print(' '); Serial.print(now.hour(), DEC); Serial.print(':'); Serial.print(now.minute(), DEC); Serial.print(':'); Serial.print(now.second(), DEC); Serial.println(); delay(1000); }