summaryrefslogtreecommitdiffstatshomepage
path: root/examples/hwapi/button_reaction.py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-02-05 18:01:42 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-02-05 18:01:42 +0300
commita4a439caa3f352f8bbbb1d0c79923270561869d3 (patch)
tree9e89effffca24b41116c82be10584ca1a85d56d7 /examples/hwapi/button_reaction.py
parentd5e9ab6e61729f533dbed5c2b6b27307ce6c3b55 (diff)
downloadmicropython-a4a439caa3f352f8bbbb1d0c79923270561869d3.tar.gz
micropython-a4a439caa3f352f8bbbb1d0c79923270561869d3.zip
examples/button_reaction: Update for time_pulse_us() no longer raising exc.
Diffstat (limited to 'examples/hwapi/button_reaction.py')
-rw-r--r--examples/hwapi/button_reaction.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/hwapi/button_reaction.py b/examples/hwapi/button_reaction.py
index 5e1890d5aa..b72e813e4c 100644
--- a/examples/hwapi/button_reaction.py
+++ b/examples/hwapi/button_reaction.py
@@ -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)