This is a very basic question so hopefully I'll get a quick basic answer...
My function blinks the led awesome but when I dispose of the led object the led turns back on and stays on until I call the function again and blink it, but then again once led.dispose(); is run the led turns on.
public void Blink_Onboard_Led(int blinks) { // Blink LED once if blinks is negative or too large if (blinks < 1 || blinks > 1000) { return; } OutputPort led = new OutputPort(Pins.ONBOARD_LED, false); for (int i = 0; i < blinks; i++) { led.Write(true); Thread.Sleep(250); led.Write(false); Thread.Sleep(250); } led.Dispose(); }
What should I do to keep the led off?