I’m trying to create a toggle switch for the backlight of the DotHat using the ButtonShim.
I tried several things :
- a toggle variable set to True and check with an if statement.
- a for r, g, b in backlight.rgb(r, g, b)…
This is my last try :
def button_a(button, pressed,):
r, g, b = backlight.rgb(r, g, b)
if r > 0 or g > 0 or b > 0:
backlight.rgb(255, 42, 255)
Sometimes i can turn off the backlight but never set an rgb value when it is off…
Does someone have an idea how to solve this ?