Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. #include <Wire.h>
  2. #include "RTClib.h"
  3. #include <LiquidCrystal.h>
  4. RTC_DS1307 RTC;
  5. LiquidCrystal lcd(8, 9, 10, 11, 12, 13);
  6. int Led=7;
  7. int H;
  8. int M;
  9. int S;
  10. void setup () {
  11. Serial.begin(9600);
  12. Wire.begin();
  13. RTC.begin();
  14. RTC.adjust(DateTime(__DATE__, __TIME__));
  15. lcd.begin(16, 2);
  16. lcd.setCursor(0,0);
  17. lcd.write("Hora");
  18. lcd.setCursor(0,1);
  19. delay(5000);
  20. lcd.clear();
  21. pinMode(Led,OUTPUT);
  22. }
  23. void loop () {
  24. DateTime now = RTC.now();
  25. hora=(now.H(),DEC);
  26. minutos=(now.M(),DEC);
  27. segundos=(now.S(),DEC);
  28. Serial.print(now.H(), DEC)
  29. Serial.print(':');
  30. Serial.print(now.M(), DEC);
  31. Serial.print(':');
  32. Serial.print(now.S(), DEC);
  33. Serial.println();
  34. lcd.clear();
  35. lcd.setCursor(0,1);
  36. lcd.print(now.H(), DEC);
  37. lcd.setCursor(2,1);
  38. lcd.print(":");
  39. lcd.setCursor(3,1);
  40. lcd.print(now.M(), DEC);
  41. lcd.setCursor(5,1);
  42. lcd.print(":");
  43. lcd.setCursor(6,1);
  44. lcd.print(now.S(), DEC);
  45. if (now.second()==3||now.second()==13||now.second()==23
  46. ||now.second()>=30 && now.second()<=39
  47. ||now.second()==43||now.second()==53)
  48. {
  49. digitalWrite(pinLed,HIGH);
  50. }
  51. delay(1000);
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement