Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.67 KB | None | 0 0
  1. void loop()
  2. {
  3. if (digitalRead(switchPin))
  4. {
  5. adjustTime(1);
  6. }
  7.   updateDisplay();
  8.     delay(1);
  9. }
  10.  
  11. void updateDisplay()
  12. {
  13.    int clockMinute = minute();
  14.   int clockHour = hourFormat12();
  15.   showHour(clockHour);    // the present hour in 12 hour format)
  16.   showMinute(clockMinute/10,clockHour);  // the present minute (0-59)
  17. }
  18.  
  19. void showMinute(int m, int r) // inputs are minuteHand and hour
  20. {
  21.   digitalWrite(segmentPins[m], ! symBols[r][m]);
  22.   delay(100);
  23.   digitalWrite(segmentPins[m], symBols[r][m]);
  24.   delay(900);
  25. }
  26.  
  27. void showHour(int n) // n is hour from 1 to 12
  28. {
  29.   for (int i = 0; i < 7; i++)
  30.   {
  31.     digitalWrite(segmentPins[i], symBols[n][i]);
  32.   }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement