#include <Wire.h>
#include <RTClib.h>
RTC_DS1307 rtc;
uint8_t listSonde[][8] = { { 0x28, 0xdc, 0x34, 0x56, 0x81, 0x22, 0x0b, 0x54 },
{ 0x28, 0x93, 0x2f, 0x46, 0x81, 0x22, 0x0b, 0x31 },
{ 0x28, 0x15, 0xC8, 0x49, 0xF6, 0x4E, 0x3C, 0xC7 },
{ 0x28, 0x75, 0x43, 0x49, 0xF6, 0xF2, 0x3C, 0xF0 },
{ 0x28, 0x87, 0x4A, 0x49, 0xF6, 0x67, 0x3C, 0x23 },
{ 0x28, 0x69, 0x45, 0x96, 0xF0, 0x01, 0x3C, 0xCC } };
char tab1[][25] = {"sondeONE","sondeTWO","sondeTHREE","sondeFOUR","sondeFIVE","sondeSIX"};
void setup() {
Serial.begin(115200);
// Initialize I2C communication
Wire.begin();
// Check if the RTC is connected properly
if (!rtc.begin()) {
Serial.println("Couldn't find RTC");
while (1);
}
// Check if the RTC lost power and if so, set the time
if (!rtc.isrunning()) {
Serial.println("RTC is NOT running!");
// This line sets the RTC with an explicit date & time, for example to set
// January 1, 2024 at 00:00 you would call:
rtc.adjust(DateTime(2024, 1, 1, 0, 0, 0));
}
}
void loop() {
DateTime now = rtc.now();
// Print the current date and time to the serial monitor
Serial.print(now.year(), DEC);
Serial.print('/');
Serial.print(now.month(), DEC);
Serial.print('/');
Serial.print(now.day(), 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); // Wait for 1 second
}