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,22 +1,26 @@
# On Pulsed
# on Pulsed
Configure the specified pin for digital input, and then
execute the associated code block whenever the pin
pulses **High** or **Low** (as specified).
Set a pin to use as a digital input and then run some code when the pin pulses either ``high`` or ``low``.
```sig
pins.onPulsed(DigitalPin.P0, PulseValue.High, () => { });
```
### ~ hint
**Simulator**: This function needs real hardware to work with. It's not supported in the simulator.
### ~
## Parameters
* ``name``: The @boardname@ hardware pin to configure (``P0`` through ``P20``)
* ``pulse``: Which state will cause the associated block to execute (**High** or **Low**)
* **name**: the @boardname@ hardware pin to set for digital input (``P0`` through ``P20``).
* **pulse**: the state that will cause the code inside the block to run, either ``high`` or ``low``.
* **body**: the code to run when the pin in **name** is pulsed to the state set in **pulse**.
## Example
The following example configures pin ``P2`` for digital input,
and then displays the string `LOW` whenever ``P2`` pulses low.
Configure pin ``P2`` for digital input. Display the string `"LOW"` whenever ``P2`` pulses ``low``.
```blocks
pins.onPulsed(DigitalPin.P2, PulseValue.Low, () => {