#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>
#include <RTClib.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
Adafruit_SH1107 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire);
RTC_DS1307 rtc;
void setup() {
Serial.begin(9600);
if (!rtc.begin()) {
Serial.println("Couldn't find RTC");
while (1);
}
if (!rtc.isrunning()) {
Serial.println("RTC is NOT running!");
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}
if (!display.begin()) {
Serial.println(F("SSD1306 allocation failed"));
for (;;);
}
//delay.display();
delay(2000);
//display.clearDisplay();
}
void loop() {
DateTime now = rtc.now();
display.setTextSize(2);
display.setTextColor(SH110X_WHITE);
display.setCursor(0, 50);
//display.print(" ");
display.println(now.toString("HH:mm:ss"));
display.display();
delay(1000);
}
अरविन्द पाटील यांचे आभासी घडयाळ 11/12/23
https://wokwi.com/projects/383731368823527425