Created
December 11, 2019 16:22
-
-
Save techzeero/c40de9728137865220813dfc28ef6925 to your computer and use it in GitHub Desktop.
RTC and LCD with Arduino Clock - https://techzeero.com/arduino-tutorials/ds3231-rtc-with-arduino-arduino-real-time-clock/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
DS3231 RTC and LCD with Arduino | |
For more details, visit: https://techzeero.com/arduino-tutorials/ds3231-rtc-with-arduino-arduino-real-time-clock/ | |
*/ | |
#include <DS3231.h> | |
#include <LiquidCrystal.h> // includes the LiquidCrystal Library | |
DS3231 rtc(SDA, SCL); | |
// initialize the library with the numbers of the interface pins | |
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); | |
void setup() | |
{ | |
rtc.begin(); // Initialize the rtc object | |
lcd.begin(16,2); | |
} | |
void loop() | |
{ | |
lcd.setCursor(0,0); | |
lcd.print("Time: "); | |
lcd.print(rtc.getTimeStr()); | |
lcd.setCursor(0,1); | |
lcd.print("Date: "); | |
lcd.print(rtc.getDateStr()); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment