Folks,
Playing with the Piglow HAT I experimented with automatically shutting the Pi down but it seems the HAT just freezes at the point of shutdown and all the LEDs remain illuminated.
Obviously if I am at the keyboard it is easy but if I want to run it for a specific time what is the best way to automatically halt the script so that the lights go out?
I’m not yet familiar enough with Python to code this into the script.
Geffers
I had the same type of issue on my Sense Hat. I run a repeating scrolling message on the LED matrix. It runs headless with a button to initiate a shutdown. My message would just stop and freeze with LEDs still illuminated. I had to add a sense.clear()
command before my os.system("sudo shutdown now -P")
command in my python file. You need the piglow equivalent. It looks like its piglow.clear()
http://docs.pimoroni.com/piglow/#clear-all-leds
1 Like
I’ll give that a go, thanks for suggestion.
I’ve learnt something, I thought when the Pi shut down that it shut down everything, seems power still gets through.
Geffers
The +5V and +3.3V on the GPIO Pins is always there if the power supply is plugged in. The 5V comes from the power supply and the 3.3V is regulated from the 5V. Any thing that gets its power from the GPIO will be powered up if the power supply is plugged in. The Pi doesn’t turn off the power supply like a PC does.
For devices like the Sense Hat and Piglow, the chips that drive the LED’s likely just retain their last state. They hold the last data written to them until you remove the power. Clear them before you stop writing new data to them and all the LED’s will be off.
I have one sense hat that I never remove the power, it runs headless with no monitor keyboard. I have it coded so when I press the joystick on the sense hat it clears the display then shuts down the Pi. To boot up again I use the Run pins on the Pi to start it up again.
1 Like
Added an LED shim to one of my projects. I had to add the following to turn it off / clear it.
ledshim.clear()
ledshim.show()
1 Like