Wrote new advanced topic

This commit is contained in:
Ron Hale-Evans 2016-07-05 16:36:09 -07:00
parent 9f1c3ee13c
commit 9ac7a4c522
1 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,31 @@
# 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).
```sig
pins.onPulsed(DigitalPin.P0, PulseValue.High, () => { });
```
### Parameters
* ``pin``: The micro:bit hardware pin to configure (``P0`` through ``P20``)
* ``pulsed``: Which state will cause the associated block to execute (**High** or **Low**)
### Example
The following example configures pin ``P2`` for digital input,
and then displays the string `LOW` whenever ``P2`` pulses low.
```blocks
pins.onPulsed(DigitalPin.P2, PulseValue.Low, () => {
basic.showString("LOW");
});
```
### See also
[servo set pulse](/reference/pins/servo-set-pulse),
[pulse duration](/reference/pins/pulse-duration),
[digital read pin](/reference/pins/digital-read-pin)