We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5e90572 commit b188d6eCopy full SHA for b188d6e
1 file changed
examples/hwapi/button_reaction.py
@@ -0,0 +1,19 @@
1
+import utime
2
+import machine
3
+from hwconfig import LED, BUTTON
4
+
5
+# machine.time_pulse_us() function demo
6
7
+print("""\
8
+Let's play an interesting game:
9
+You click button as fast as you can, and I tell you how slow you are.
10
+Ready? Cliiiiick!
11
+""")
12
13
+while 1:
14
+ try:
15
+ delay = machine.time_pulse_us(BUTTON, 1, 10*1000*1000)
16
+ print("You are as slow as %d microseconds!" % delay)
17
+ except OSError:
18
+ print("Well, you're *really* slow")
19
+ utime.sleep_ms(10)
0 commit comments