pxt-calliope/docs/reference/pins/on-pulsed.md
Sam El-Husseini e3975e65e5 pxt-microbit Accessibility PR (#529)
* Accessibility changes
2017-09-07 13:42:08 -07:00

827 B

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).

pins.onPulsed(DigitalPin.P0, PulseValue.High, () => { });

Parameters

  • name: The @boardname@ hardware pin to configure (P0 through P20)
  • pulse: 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.

pins.onPulsed(DigitalPin.P2, PulseValue.Low, () => {
    basic.showString("LOW");
});

See also

servo set pulse, pulse duration, digital read pin