Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- #include <DS1302.h>
- #include <LiquidCrystal_I2C.h>
- DS1302 rtc(2, 3, 4);
- LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
- void setup() {
- rtc.halt(false);
- rtc.writeProtect(false);
- Serial.begin(9600);
- lcd.begin(16,2);
- // Modify the below lines just once and upload, then comment or delete them!
- rtc.setDOW(SATURDAY); // Set the day of the week
- rtc.setTime(13, 05, 40); // Set the time hh:mm:ss
- rtc.setDate(04, 11, 2017); // Set the date dd:mm:yyyy
- }
- void loop() {
- lcd.setCursor(0, 0);
- lcd.print(rtc.getTimeStr());
- lcd.setCursor(8, 0);
- lcd.print(rtc.getDOWStr(FORMAT_SHORT));
- lcd.setCursor(1,1);
- lcd.print("*");
- lcd.setCursor(3, 1);
- lcd.print(rtc.getDateStr());
- lcd.setCursor(14, 2);
- lcd.print("*");
- delay (1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement