Microsoft MakeCode

Pin events

Ssomeone asked this on Adafruit forums:

I have been unable to get PINS->“onEvent” to work. This not the “onEvent” front he “INPUT”. But I have not been able to get any event: fall, rise, pulse high or pulse low. I can poll the pin just fine in the forever loop.

Here is a minimal code I was testing with:

Code: Select all | TOGGLE FULL SIZE

pins.A7.onEvent(PinEvent.Fall, function () { light.setAll(0xff8000)})pins.A7.setPull(PinPullMode.PullUp)forever(function () { })

For this case I was connecting GND to A7 with a wire and there was no effect.

This is with the Circuit Playground express.

Thanks for the help.

https://forums.adafruit.com/viewtopic.php?f=64&t=161297

I can get this to work in the simulator, but not on hardware. Any ideas?

1 Like