File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,19 @@ Miscellaneous functions
101
101
varies by hardware (so use substring of a full value if you expect a short
102
102
ID). In some MicroPython ports, ID corresponds to the network MAC address.
103
103
104
+ .. function :: time_pulse_us(pin, pulse_level, timeout_us=1000000)
105
+
106
+ Time a pulse on the given `pin `, and return the duration of the pulse in
107
+ microseconds. The `pulse_level ` argument should be 0 to time a low pulse
108
+ or 1 to time a high pulse.
109
+
110
+ The function first waits while the pin input is different to the `pulse_level `
111
+ parameter, then times the duration that the pin is equal to `pulse_level `.
112
+ If the pin is already equal to `pulse_level ` then timing starts straight away.
113
+
114
+ The function will raise an OSError with ETIMEDOUT if either of the waits is
115
+ longer than the given timeout value (which is in microseconds).
116
+
104
117
.. _machine_constants :
105
118
106
119
Constants
You can’t perform that action at this time.
0 commit comments