Hi,
I’m wondering if there is a way to check the backlight status on a Displayotron 3000 (e.g., if the backlight is currently on, or off), so that when I push the joystick button the backlight is either toggled on or off.
I tried to do the following, but it doesn’t work.
@nav.on(nav.BUTTON)
def handle_button(pin):
if backlight.off():
backlight.rgb(50, 255, 50)
else:
backlight.off()
The only way I managed to accomplish this is if I introduce a variable called “status” and change to either True or False. It works, but it doesn’t seem to be an elegant solution.
@nav.on(nav.BUTTON)
def handle_button(pin):
global status
if status:
backlight.off()
status=False
else:
backlight.rgb(50, 255, 50)
status=True