Simulator
This function needs real hardware to work with. It’s not supported in the simulator.
Set a pin to use as a digital input and then run some code when the pin pulses either high or low.
pins.onPulsed(DigitalPin.P0, PulseValue.High, () => { });
This function needs real hardware to work with. It’s not supported in the simulator.
P0 through P20).high or low.Configure pin P2 for digital input. Display the string "LOW" whenever P2 pulses low.
pins.onPulsed(DigitalPin.P2, PulseValue.Low, () => {
basic.showString("LOW");
});