Commit a4a439ca authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

examples/button_reaction: Update for time_pulse_us() no longer raising exc.

parent d5e9ab6e
......@@ -11,9 +11,9 @@ Ready? Cliiiiick!
""")
while 1:
try:
delay = machine.time_pulse_us(BUTTON, 1, 10*1000*1000)
print("You are as slow as %d microseconds!" % delay)
except OSError:
delay = machine.time_pulse_us(BUTTON, 1, 10*1000*1000)
if delay < 0:
print("Well, you're *really* slow")
else:
print("You are as slow as %d microseconds!" % delay)
utime.sleep_ms(10)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment