I have started hobby development on a netduino 2. I'm struggling with interrupts on the onboard button. My problem is, that the interrupt is called several times for each time i press the button.
public static void Main()
{
dac = new Dac();
InterruptPort button = new InterruptPort(Pins.ONBOARD_SW1, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeHigh);
button.OnInterrupt += new NativeEventHandler(button_OnInterrupt);
Thread.Sleep(Timeout.Infinite);
}
static void button_OnInterrupt(uint data1, uint data2, DateTime time)
{
if(data2 == 1)
{
dac.nextDACState();
}
}
*Dac is a custom Digital To Analog Converter. Nothing fancy here.
Is this a implementation fault, og maybe a faulty button, that flickers?