Hello all,
I'm working on a project using the Netduino Plus 2. I am trying to run a series of tests on the components of a circuit board, and am looking to control each test using interrupts triggered by switches. In all, I have 6 tests (and subsequently 6 switches with 6 interrupts).
Here's where my current issue lies:
I am having the Netduino light LED's upon successful completion of each test. If the test is unsuccessful, I blink the LED. My program enters the interrupt when the switch is flipped and lights (or flashes) the LED, but when I flip the switch back off, the LED remains lit (or stays flashing). Essentially, the LED behavior continues even after I turn off the switch to the test.
A) I am wondering if I am not exiting the interrupt properly.
I am also wondering if my set up involving the blinking LED is the correct route to take, or if I have just simply set myself up for an endless loop.
The following is a sample of one of my interrupts. Any help would be much appreciated!
static void U1TestSwitch_OnInterrupt(uint data1, uint data2, DateTime time) { J1pin3.Write(false); J1pin5.Write(false); J1pin7.Write(false); J1pin4.Read(); if (J1pin4.Read() == true) { U1TLED.Write(true); } else if (J1pin4.Read() == false) { while (J1pin4.Read() == false) { U1TLED.Write(true); Thread.Sleep(100); U1TLED.Write(false); Thread.Sleep(100); if (U1TestSwitch.Interrupt == Port.InterruptMode.InterruptEdgeLow) { break; } } } if (U1TestSwitch.Interrupt == Port.InterruptMode.InterruptEdgeLow) { U1TLED.Write(false); U1TestSwitch.ClearInterrupt(); } }