delay(1000); // Update every second

void loop() // 1. Read the current time from the chip myRTC.updateTime();

| RTC Module Pin | Arduino Uno/Nano | Arduino Mega 2560 | ESP8266 (NodeMCU) | | :------------ | :--------------- | :---------------- | :---------------- | | | 5V | 5V | 3.3V | | GND | GND | GND | GND | | SCL | A5 | 21 | D1 (GPIO5) | | SDA | A4 | 20 | D2 (GPIO4) |

void setup() // Wake up Wire.begin(); myRTC.updateTime(); Serial.println(myRTC.minutes); // Enter deep sleep for 1 minute ESP.deepSleep(60e6);

lcd.setCursor(0, 1); lcd.print("Date: "); if(myRTC.dayofmonth < 10) lcd.print("0"); lcd.print(myRTC.dayofmonth); lcd.print("/"); if(myRTC.month < 10) lcd.print("0"); lcd.print(myRTC.month); lcd.print("/20"); lcd.print(myRTC.year);

// 3. Print to LCD lcd.setCursor(0, 0); lcd.print("Time: "); if(myRTC.hours < 10) lcd.print("0"); lcd.print(myRTC.hours); lcd.print(":"); if(myRTC.minutes < 10) lcd.print("0"); lcd.print(myRTC.minutes);

#include <VirtuabotixRTC.h> // Pin definition for Uno/Nano // (SDA, SCL) VirtuabotixRTC myRTC(A4, A5); This is your most important function. It reads the current time from the RTC chip and stores it in the myRTC object's variables.

unsigned long getUnixTime(VirtuabotixRTC &rtc) rtc.updateTime(); // Use a helper function (requires <TimeLib.h>) return makeTime(rtc); // This requires conversion logic