FUN 1. PB-A Switches between “clock mode” and “sleep mode”. Clock…

Question FUN 1. PB-A Switches between “clock mode” and “sleep mode”. Clock… FUN 1. PB-A Switches between “clock mode” and “sleep mode”. Clock mode: two digits for each of the numbers (hours, minutes, and seconds). HH : MM : SS Sleep mode: . Sleep Mode (…)  FUN 2. When in “clock mode”, PB-B and PB-C increment and decrement HH in the range of 01- 24 hr, respectively. Incrementing 24 goes down to 01 and decrementing 01 goes up to 24.  FUN 3. When in “clock mode”, PB-D and PB-E increment and decrement MM in the range of 00-59 min, respectively. Incrementing 59 goes down to 00 and decrementing 00 goes up to 59. FUN 4. When in “sleep mode”, PB-B switches between the “(0)” and “(1)” as follows: First push: Sleep Mode (0) Second push: Sleep Mode (1)  FUN 5. Program should work smoothly without any bugs. Specifically, the “clock mode” and “sleep mode” should preserve their latest status and updated values after multiple switchings. Moreover, incrementing MM from 59 to 00 by PB-D should not increment HH, and decrementing MM from 00 to 59 by PB-E should not decrement HH.  Hint. Python program to display a clock in the output: import time hour = 3600; # 3600 seconds in an hour minute = 60; # 60 seconds in a minute second = 1; # 1 seconds in a second t0 = time.time() while True: t = time.time() timeNow = int(t-t0) hours = int(timeNow / hour) #number of hours minutes = int((timeNow % hour) / minute) #remainder from hours division (msec) divided by minute #This gives the full minutes seconds = int(((timeNow % hour) % minute)); if hours<10: hours_str=str(0)+str(hours) else: hours_str=str(hours) if minutes<10: minutes_str=str(0)+str(minutes) else: minutes_str=str(minutes) if seconds<10: seconds_str=str(0)+str(seconds) else: seconds_str=str(seconds) print(hours_str,':',minutes_str,':',seconds_str) Engineering & Technology Electrical Engineering ECET 411 Share QuestionEmailCopy link Comments (0)