megadeth9001

Untitled

Aug 26th, 2016
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. //*testing code*//
  2.  
  3. #include <Time.h>
  4. #include <TimeLib.h>
  5.  
  6. #define latchpin 2
  7. #define datapin 3
  8. #define clockpin 4
  9. byte hours1thr8 = 0;
  10. int currenthours1thr8 = 0;
  11. int h, m;
  12.  
  13. void setup() {
  14. pinMode(latchpin,OUTPUT);
  15. pinMode(datapin,OUTPUT);
  16. pinMode(clockpin,OUTPUT);
  17. }
  18.  
  19. void loop() {
  20.  
  21. h = hours();
  22. m = minutes();
  23. {
  24. if(h <= 20) {
  25. int remainder = h % 12;
  26. if(0 < remainder && remainder < 9)
  27. currenthours1thr8 = remainder - 1;
  28. }
  29. }
  30. {
  31. bitSet(hours1thr8, currenthours1thr8);
  32. digitalWrite(latchpin,LOW);
  33. shiftOut(datapin,clockpin,LSBFIRST,hours1thr8);
  34. digitalWrite(latchpin,HIGH);
  35. delay(2000);
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment