DS3231 RTC Module & OLED Display 0.96" I2C 128x64 SSD1306 with Arduino | English Subtitle

  Рет қаралды 102

DoIt.20

DoIt.20

Күн бұрын

DS3231 RTC Module & OLED Display 0.96" I2C 128x64 SSD1306 with Arduino | English Subtitle
Code : code is on the comment below.
Facebook : / doit20-104218935882053
Please Subscribe my Channel. ThankYou!

Пікірлер: 3
@doit.20
@doit.20 4 ай бұрын
#include #include #include #include #define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 64 // OLED display height, in pixels #define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); RTC_DS3231 rtc; void setup() { Serial.begin(9600); // Initialize the OLED display if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x64 Serial.println(F("SSD1306 allocation failed")); for(;;); // Don't proceed, loop forever } // Initialize the DS3231 RTC if (!rtc.begin()) { Serial.println("Couldn't find RTC"); while (1); } if (rtc.lostPower()) { Serial.println("RTC lost power, let's set the time!"); // The following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // Uncomment the next line to set the date & time manually // rtc.adjust(DateTime(2024, 5, 25, 12, 0, 0)); } display.display(); delay(2000); // Pause for 2 seconds display.clearDisplay(); } void loop() { DateTime now = rtc.now(); // Clear the buffer display.clearDisplay(); display.setTextSize(2); // Larger text size display.setCursor(22, 0); display.print("DoIt.20"); // Display the current date display.setTextSize(1); // Larger text size display.setCursor(0, 25); display.print("Date: "); display.print(now.year(), DEC); display.print('/'); if (now.month() < 10) display.print('0'); display.print(now.month(), DEC); display.print('/'); if (now.day() < 10) display.print('0'); display.print(now.day(), DEC); // Display the current time display.setTextSize(2); // Larger text size display.setTextColor(SSD1306_WHITE); display.setCursor(0, 40); // display.print("Time: "); if (now.hour() < 10) display.print('0'); display.print(now.hour()); display.print(':'); if (now.minute() < 10) display.print('0'); display.print(now.minute()); display.print(':'); if (now.second() < 10) display.print('0'); display.print(now.second()); // Show the buffer on the display display.display(); // Wait for a second before updating delay(1000); }
@malikamanchanayake5006
@malikamanchanayake5006 3 ай бұрын
Works like a Charm.... Thanks a lot Bro
@prestononuselogu9973
@prestononuselogu9973 4 ай бұрын
Woah, thanks :)
Inside Out 2: BABY JOY VS SHIN SONIC 3
00:19
AnythingAlexia
Рет қаралды 8 МЛН
MILLING PCB PANEL with Snapmaker 2.0 CNC
4:52
Garage Factory SD
Рет қаралды 15 М.
How to set up an OLED display with Arduino
5:10
HFZ
Рет қаралды 689
Arduino | DHT11 | LCD I2C | RTC DS1307 | Arduino project
1:29
Arduino Titan
Рет қаралды 353
MQ2 Gas Sensor with oled display
4:45
RoboTech X
Рет қаралды 829
I built a bitcoin price ticker using an ESP32
4:50
Lucas Fernando
Рет қаралды 631