first commit

This commit is contained in:
Jérôme Delacotte
2025-03-06 11:15:32 +01:00
commit 7b30d6e298
5276 changed files with 2108927 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
// Date and time functions using just software, based on millis() & timer
#include <RTClib.h>
RTC_Millis rtc;
// buffer for DateTime.tostr
char buf[20];
void setup() {
Serial.begin(9600);
// following line sets the RTC to the date & time this sketch was compiled
rtc.begin(DateTime(__DATE__, __TIME__));
}
void loop() {
DateTime now = rtc.now();
Serial.println(now.tostr(buf));
Serial.print(" seconds since 1970: ");
Serial.println(now.unixtime());
// calculate a date which is 7 days and 30 seconds into the future
DateTime future(now + (7 * 86400L + 30));
Serial.println(future.tostr(buf));
Serial.println();
delay(3000);
}