Update 'pins' ref pages (#1733)

* Update 'pins' ref pages

* Some jsdoc touchups
This commit is contained in:
Galen Nickel
2019-01-03 16:02:19 -08:00
committed by Peli de Halleux
parent 7856c046f4
commit 079cd67c38
17 changed files with 214 additions and 113 deletions

View File

@ -1,21 +1,26 @@
# Pulse Duration
# pulse Duration
Gets the duration of the last pulse in microseconds.
This function should be called from an **on pulsed** handler.
Get the duration of the last pulse in microseconds.
```sig
pins.pulseDuration();
```
A pin pulse is detected in the [onPulsed](/reference/pins/on-pulsed) event. You use **pulseDuration** inside that event to get the duration of the pulse that triggered the event.
### ~ hint
**Simulator**: This function needs real hardware to work with. It's not supported in the simulator.
### ~
## Returns
The duration of the last pulse, measured in microseconds.
* a [number](/types/number) that is the duration of the last pulse, measured in microseconds.
## Example
The following example waits for pin ``P0`` to be pulsed high, and then
displays the duration of the pulse in microseconds on the LED screen.
Wait for pin ``P0`` to be pulsed high. Display the duration of the pulse in microseconds on the LED screen.
```blocks
pins.onPulsed(DigitalPin.P0, PulseValue.High, () => {