I wrote and small script
to control the Backlight using the buttons on the display, followed the examples on the wiki, But when i turn in Off and on again sometimes it turns White when its on and there is nothing on the screen.... Can anyone help me figure out a fix for this or could it just be a hardware issue???
Code: Select all
from gpiozero import Button from time import sleep import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(27, GPIO.OUT) backlightON = Button(17) backlightOFF = Button(4) isON = True while True: if (isON) and (backlightOFF.is_pressed): isON = False GPIO.output(27, GPIO.LOW) print "Screen OFF" elif (not isON) and (backlightON.is_pressed): isON = True GPIO.output(27, GPIO.HIGH) print "Screen ON" sleep(.04)