static InterruptPort iPort = new InterruptPort( Pins.GPIO_PIN_D0, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth ); iPort.EnableInterrupt( ); iPort.OnInterrupt += new NativeEventHandler( iPort_OnInterrupt );
static void iPort_OnInterrupt( uint data1, uint data2, DateTime time ) { if( data2 == 1 ) Debug.Print( counter++ + ".) " + data2.ToString( ) ); }
When I short Digital I/O pin zero to GND I get Data2 == 0, that is great and what I want.
BUT; when I remove the short I get between 3 and 5 open and close events. e.g. 1010101
I'm shorting zero to GND threw a relay which is held closed for 200 milliseconds via a 555 timer so as to remove human error on the physical switch event. I have tried it free hand with a piece of wire also.
Am I doing something wrong. Surely it is possible to cleanly measure a closing contact on the Netduino.