Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- #include "RTClib.h"
- #include <LiquidCrystal.h>
- RTC_DS1307 RTC;
- LiquidCrystal lcd(8, 9, 10, 11, 12, 13);
- int Led=7;
- int H;
- int M;
- int S;
- void setup () {
- Serial.begin(9600);
- Wire.begin();
- RTC.begin();
- RTC.adjust(DateTime(__DATE__, __TIME__));
- lcd.begin(16, 2);
- lcd.setCursor(0,0);
- lcd.write("Hora");
- lcd.setCursor(0,1);
- delay(5000);
- lcd.clear();
- pinMode(Led,OUTPUT);
- }
- void loop () {
- DateTime now = RTC.now();
- hora=(now.H(),DEC);
- minutos=(now.M(),DEC);
- segundos=(now.S(),DEC);
- Serial.print(now.H(), DEC)
- Serial.print(':');
- Serial.print(now.M(), DEC);
- Serial.print(':');
- Serial.print(now.S(), DEC);
- Serial.println();
- lcd.clear();
- lcd.setCursor(0,1);
- lcd.print(now.H(), DEC);
- lcd.setCursor(2,1);
- lcd.print(":");
- lcd.setCursor(3,1);
- lcd.print(now.M(), DEC);
- lcd.setCursor(5,1);
- lcd.print(":");
- lcd.setCursor(6,1);
- lcd.print(now.S(), DEC);
- if (now.second()==3||now.second()==13||now.second()==23
- ||now.second()>=30 && now.second()<=39
- ||now.second()==43||now.second()==53)
- {
- digitalWrite(pinLed,HIGH);
- }
- delay(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement