I would like to turn off the display backlight based on the ambient light. I can see the backlight is mapped to GPIO 25. How can this pin be controlled ?
You can use RPi.GPIO to control the pin. Pull it low to turn the backlite off. If you want to control the brightness you will have to use PWM.
thanks, does that mean I need to import RPi.GPIO lib or is it included in automatiohat ?
Yes you would have to import RPi.GPIO. It would go something like this. I’ve only ever used it with a pin set as an input to detect button presses.
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(25, GPIO.OUT)
1 Like