Read the statement by Michael Teeuw here.
Autobrightness 7" Touchscreen based on Ambient Light
-
I found this posting and will try to install it this week. Just use google translate to translate from its native Turkish.
http://www.ilhanakilli.com.tr/sbc/raspberry-pi-7-dokunmatik-ekran-otomatik-parlaklik/
-
Well I’ve done the wiring. I think it’s correct. I’m wiring directly with the pins on the pi.
I get the error
sudo: unable to execute ./backlight.py: No such file or directoryHere’s the code. Any help would be appreciated.
import RPi.GPIO as GPIO import time In gpıo.setmo (GPIO.BOARD) #ldr reading pisi identification pin_to_ldr = 7 def rc_time (pin_to_ldr): count = 0 #Output on the pin for GPIO.setup (pin_to_ldr, GPIO.OUT) GPIO.output (pin_to_ldr, GPIO.LOW) time.sleep (0.01) #Change the pin back to input GPIO.setup (pin_to_ldr, GPIO.IN) #Count until the pin goes high while (GPIO.input (pin_to_ldr) == GPIO.LOW): count + = 1 return count #Catch when script is interrupted, cleanup correctly try: # Main loop while True: bl = open ('/ sys / class / backlight / rpi_backlight / brightness', 'w' read = 0 read = rc_time (pin_to_ldr) if read
-
@hengy
Well it seems to be working. What was missing from the cut and paste I did of the code was#! / Usr / local / bin / python
Seems /usr/local/bin/python doesn’t exist on my pi. I changed it to usr/bin/python. Also
okunan means read in Turkish. I changed it back to read. I ran this in a terminal and it seems to work. Nice, I now have a screen which changes to ambient light.