2.1.28, initiation update to PXT v5.28.24 (#54)

This commit is contained in:
Amerlander
2019-12-02 05:58:26 +01:00
committed by Peli de Halleux
parent 38a964516e
commit 5c114a0c57
1261 changed files with 50692 additions and 21604 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, () => { });
```
### Parameters
### ~ hint
* ``name``: The @boardname@ hardware pin to configure (``P0`` through ``P20``)
* ``pulse``: Which state will cause the associated block to execute (**High** or **Low**)
**Simulator**: This function needs real hardware to work with. It's not supported in the simulator.
### Example
### ~
The following example configures pin ``P2`` for digital input,
and then displays the string `LOW` whenever ``P2`` pulses low.
## Parameters
* **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
Configure pin ``P2`` for digital input. Display the string `"LOW"` whenever ``P2`` pulses ``low``.
```blocks
pins.onPulsed(DigitalPin.P2, PulseValue.Low, () => {
@@ -24,7 +28,7 @@ pins.onPulsed(DigitalPin.P2, PulseValue.Low, () => {
});
```
### See also
## See also
[servo set pulse](/reference/pins/servo-set-pulse),
[pulse duration](/reference/pins/pulse-duration),