MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Autobrightness 7" Touchscreen based on Ambient Light

    Scheduled Pinned Locked Moved General Discussion
    3 Posts 1 Posters 1.3k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      hengy
      last edited by

      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/

      1 Reply Last reply Reply Quote 0
      • H Offline
        hengy
        last edited by hengy

        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 directory

        Here’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
        H 1 Reply Last reply Reply Quote 0
        • H Offline
          hengy @hengy
          last edited by

          @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.

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • 1 / 1
          • First post
            Last post
          Enjoying MagicMirror? Please consider a donation!
          MagicMirror created by Michael Teeuw.
          Forum managed by Sam, technical setup by Karsten.
          This forum is using NodeBB as its core | Contributors
          Contact | Privacy Policy