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

examples/hwapi: Add example for machine.time_pulse_us().

parent 5e905721
import utime
import machine
from hwconfig import LED, BUTTON
# machine.time_pulse_us() function demo
Let's play an interesting game:
You click button as fast as you can, and I tell you how slow you are.
Ready? Cliiiiick!
while 1:
delay = machine.time_pulse_us(BUTTON, 1, 10*1000*1000)
print("You are as slow as %d microseconds!" % delay)
except OSError:
print("Well, you're *really* slow")
Supports Markdown
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