Basic error codes flashed thru LED

OK, here’s a thought I’ve just started, wondering if anyone has done this before that has code they can post, or has seen interesting ways to document and implement this.

Some embedded devices have little/no UI, so visual cues like a LED flash are used to report status and errors. In my current project I have a few (maybe up to 6?) different status codes I want to be reflected on the LED. That includes a “heartbeat” to show there’s activity when the monitoring is working and there’s nothing unusual about the sensor state.

I was thinking a list of flash durations in a sequence would be a good start. Heartbeat is 2000msec long, with 150msec “on” time. Another status (in my case when the garage door is not fully closed) could be 1000msec long with 150msec on, 150msec off, and 150msec on again. Another status (door not closed after X minutes and an alert sent) could be 1000msec, 150msec/150msec/300msec. Another status (network not connected) could be 1000/300/150/150.

Another approach could be that you use the number of flashes rather than the duration as the error code. 1 flash means all ok, 2 means door not closed, 3 means door not closed and alert sent, 4 means network not connected, etc etc.

What, if anything, have other people implemented or seen implemented, and how did you achieve this (thinking about things like threading, data arrays etc)

I done LED debugging very long time ago when I had no JTAG and NETMF didn’t exist. The LED blinking will tell me what is going on. I even had to blink the led and the count gave me the stage where my program is!

Man, forget I work for GHI, thank god for GHI and NETMF. It just make developer life much easier :slight_smile:

I do not any of that code … was done way too long ago!

I’m cool with debugging it via VS or MFDeploy, but when it’s in-situ and in normal operation locked in the garage, I just want a status indicator.

So far I’ve been testing a 2000msec cycle, and a status flash of 150msec, where one flash is normal, and anything more tells us that things are not closed.