Home of the Squeezebox™ & Transporter® network music players.
Page 5 of 5 FirstFirst ... 345
Results 41 to 43 of 43
  1. #41
    You need at least three hands for soldering. :-)
    You should verify that you haven't created a shortcut between two of the pins.

    Yes, python3.8-smbus.tcz is the correct extension.

    If there are not shortcuts then we can search step by step for the failure.

    1) The kernel module i2c_dev is loaded? You can check if the command was successful with

    $ lsmod | grep i2c
    One line of the output should start with i2c_dev:
    i2c_dev 20480 2


    2) The Python script should be executable. You can verify it with the command "ls -l":

    tc@SB-Kitchen:~/lux$ ls -l display-control.py
    -rwxr-xr-x 1 tc staff 4261 Mar 19 21:40 display-control.py

    Important are the three 'x' for executable. If they are missing then you can change it with

    $ chmod 755 display-control.sh


    3) Verify that the script measuring something.
    The script is able to print the measuring results to stdout (i.e. your command line). To enable this feature, you need to edit the script.
    Change line 21 from
    DEBUG = False
    to
    DEBUG = True

    If the script is still running in the background then we have to stop it.

    $ ps -ef | grep display
    root 6647 6414 0 21:40 pts/0 00:00:00 /usr/local/bin/python3 /home/tc/lux/display-control.py
    tc 7400 6414 0 21:53 pts/0 00:00:00 grep display


    in this case, 6647 is the PID of the process 'display-control.py'. You will get a different number.To stop the script, you need to kill the process with 'sudo kill <PID>. In my case:

    $ sudo kill 6647

    Now we execute the script manually:

    $ ./display-control.py

    You should get output similar to the following (I used a electric torch so that some values are extremely high):
    Light Level : 25.00 lx
    Display: 18
    Light Level : 29.17 lx
    Display: 19
    Light Level : 450.00 lx
    Display: 121
    Light Level : 466.67 lx
    Display: 125
    Light Level : 2408.33 lx
    Display: 255
    Light Level : 16787.50 lx
    Display: 255
    Light Level : 29.17 lx
    Display: 19

    Light Level : 0.00 lx
    Display: 11


    4) Are you able to write to the file '/sys/class/backlight/rpi_backlight/brightness'. You can check it these two commands:

    $ echo 60 > /sys/class/backlight/rpi_backlight/brightness


    and

    $ cat /sys/class/backlight/rpi_backlight/brightness
    60


    The first command should be executed without an error message and the second should return value that you wrote into the file (in this case 60).

    So, let's see how far you get with your tests.

  2. #42

    Success !!

    I hadn't made the script executable, step 2 in your post above. As soon as I did that with chmod it's working as expected, which is brilliant ! Thanks ! I now have auto brightness for just ú2.50, what a bargain. I do love this community. Cheers jd68

  3. #43
    Congratulations! Good to know that you could fix your problem.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •