Can anyone give me a hint (or debugging suggestion) why this simple program would quit blinking and sending debug data? It runs fine for about a half-hour then stops, but VS says it’s still running. It’s on a Fez Duino. Looking at the memory management docs it should be ok. Garbage collected? Doesn’t look like any race condition. I tried a variation where Blink just set a flag and the LED handled in a main loop, and that also had the same problem. Looks like main is still running but the timer is no longer getting triggered for some reason. Thanks!
static GpioPin LED;
static void Main()
{
LED = GpioController.GetDefault().OpenPin(SC20100.GpioPin.PE11);
LED.SetDriveMode(GpioPinDriveMode.Output);
new Timer(Blink, null, 1000, 5000);
Thread.Sleep(Timeout.Infinite);
}
static void Blink(object o)
{
DateTime dt = DateTime.UtcNow;
Debug.WriteLine(dt.ToString());
LED.Write(GpioPinValue.High);
Thread.Sleep(200);
LED.Write(GpioPinValue.Low);
}