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)