Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

MakeCode onEvent PinEvent
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

MakeCode onEvent PinEvent

by fumoffu on Thu Jan 23, 2020 11:28 am

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.

fumoffu
 
Posts: 1
Joined: Thu Aug 31, 2017 10:21 pm

Re: MakeCode onEvent PinEvent

by johnpark on Mon Jan 27, 2020 1:07 pm

Good question, I can't get that to work on hardware either. Seems it works in the simulator. I've asked on Microsoft's MakeCode forum to see if there's any thoughts on it over there.
https://forum.makecode.com/t/pin-events/1122

johnpark
 
Posts: 767
Joined: Wed Mar 25, 2009 2:15 pm

Please be positive and constructive with your questions and comments.