diff --git a/stopwatchSkeleton.py b/stopwatchSkeleton.py new file mode 100644 index 0000000000000000000000000000000000000000..18ede2b2c27aa9fb3018e9777c4bd0f07cb6441f --- /dev/null +++ b/stopwatchSkeleton.py @@ -0,0 +1,27 @@ +import machine +import utime + +#TODO: Initialise start/stop buttons and the buzzer for signalling the end of the stopwatch + +while True: + + while start.value() == 1: + utime.sleep_ms(10) + #TODO: Get the current time when start button is pressed + + print("Start timer") + + + while stop.value() == 1: + utime.sleep_ms(10) + #TODO: Get the current time when stop button is pressed + buzzer_pin.value(1) + utime.sleep(0.5) + buzzer_pin.value(0) + + print("Timer stopped") + + + #TODO: Find the elapsed time in ms + timeInSecs = time / 1000 + print("Stopwatch time:", timeInSecs, "s")