Update 'pins' ref pages (#1733)
* Update 'pins' ref pages * Some jsdoc touchups
This commit is contained in:
committed by
Peli de Halleux
parent
7856c046f4
commit
079cd67c38
@ -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, () => {
|
||||
|
Reference in New Issue
Block a user