Unicorn hat, how to set pixels and exit?


#1

It seems as though I need to loop a set_pixel() and show() to keep a pixel lit.

Can i set_pixel(), show() and exit() without the pixel “blanking/clearing”?


#2

At the moment the Python library will always clear the buffer on exit.

You might be able to stop it like so:

import unicornhat
import atexit
atexit.unregister(unicornhat.off)

# Do your set_pixel and show here

#3

Thanks, I’ll give that a shot.
If I background (shell job control) a python unicornat loop and send it a SIGTERM, the LEDs don’t clear and stay lit, so not sure how the library deals with exits.

At the moment i’m just trying to set a color via cgi. The color gets set, but as you’ve confirmed, only for a split second.

Do you have any tips?