#include "RTClib.h" RTC_DS3231 rtc; char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; int sensorPin1 = A0; int sensorPin2 = A1; int sensorPin3 = A2; int sensorPin4 = A3; void setup() { // put your setup code here, to run once: Serial.begin(9600); #ifndef ESP8266 while (!Serial); // wait for serial port to connect. Needed for native USB #endif if (! rtc.begin()) { Serial.println("Couldn't find RTC"); Serial.flush(); abort(); } if (rtc.lostPower()) { Serial.println("RTC lost power, let's set the time!"); // When time needs to be set on a new device, or after a power loss, the // following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(2021,3,4, 13,42,30)); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); } rtc.adjust(DateTime(2021,12,7, 14,13,15)); } void loop() { // put your main code here, to run repeatedly: float voltage1, voltage2, voltage3, voltage4; voltage1 = (analogRead(sensorPin1)/1024.0) * 5000; voltage2 = (analogRead(sensorPin2)/1024.0) * 5000; voltage3 = (analogRead(sensorPin3)/1024.0) * 5000; voltage4 = (analogRead(sensorPin4)/1024.0) * 5000; DateTime now = rtc.now(); 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(); Serial.print("Sensor 1: "); Serial.println(voltage1); Serial.print("Sensor 2: "); Serial.println(voltage2); Serial.print("Sensor 3: "); Serial.println(voltage3); Serial.print("Sensor 4: "); Serial.println(voltage4); delay(5000); }