A shutdown button for an embedded application is very easy to do, but what's harder is how to indicate to a non-technical operator when it's safe to pull the plug.
In the script triggered by the shutdown button I could set a GPIO pin to output and write "1" to it. I could use that output to flash a warning LED until it went to zero on completion of shutdown. But when I try it, the ACT light (on a Pi Zero) continues to flash regularly for several seconds after the GPIO goes to zero. (I'm using Raspbian, if that's relevant.)
I've noticed similarly on the Model B that the ACT light flashes regularly for several seconds at the end of the shutdown sequence.
Can anyone enlighten me as to what it's doing during those final flashes? Is it indeed writing to the SDCard, making it dangerous to pull the plug at that time? Is there another way of determining when the shutdown really has completed?
Regards - Philip