Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void loop()
- {
- if (digitalRead(switchPin))
- {
- adjustTime(1);
- }
- updateDisplay();
- delay(1);
- }
- void updateDisplay()
- {
- int clockMinute = minute();
- int clockHour = hourFormat12();
- showHour(clockHour); // the present hour in 12 hour format)
- showMinute(clockMinute/10,clockHour); // the present minute (0-59)
- }
- void showMinute(int m, int r) // inputs are minuteHand and hour
- {
- digitalWrite(segmentPins[m], ! symBols[r][m]);
- delay(100);
- digitalWrite(segmentPins[m], symBols[r][m]);
- delay(900);
- }
- void showHour(int n) // n is hour from 1 to 12
- {
- for (int i = 0; i < 7; i++)
- {
- digitalWrite(segmentPins[i], symBols[n][i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement