Skip to content
Snippets Groups Projects
Commit 120fcfb7 authored by ef1g21's avatar ef1g21
Browse files

Upload New File

parent ac36e25b
No related branches found
No related tags found
No related merge requests found
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")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment