Interrupt doesn't work


I’m having a problem with my interrupt.
I have a PIR sensor connected to pin 3 of an extender module.
I’m using the autogenerated code from a Gadgeteer Module project and yet it doesn’t react.

The PIR sensor works on 3.3V, and returns 3.3 when motion is detected.
I’ve placed a 10kOhm resistor between pin3 and ground of the extender module.

I found a solution:

I added this:

this.input.SynchronousUnsafeEventInvocation = true;

and removed this:

if (Program.CheckAndInvoke((PIRsensorState == PIRsensorState.High ? this.PIRsensorHigh : this.PIRsensorLow), this.onPIRsensor, sender, PIRsensorState))

The only problem is that I’m not sure what I’ve done. So if anyone can clarify a bit please?


Without seeing your original code and the PIR driver, how can we comment?

No need, I’m using the auto-generated code from a Gagdeteer Module Project.

The only thing I adjusted in that code are the two lines I gave in my previous post

The “ProgramStarted()” method is for initialization purposes only and shouldn’t be blocked.