I made it! But I've got some troubles. First of all, python script
doesn't run. When I add "smbus-python3.6.tcz" it's moved
to uninstalled list. Now I'm using .sh script. It's work. But minimal
brightness sets by program even I turn on piCorePlayer and brightness in
room is so low. I use next variables:
Code:
--------------------
#!/bin/sh
WDIR=/home/tc/lux
# if the measured value is below MIN_THRESHOLD then the display is set to
MIN_BRIGHTNESS
MIN_THRESHOLD=1
MIN_BRIGHTNESS=20
# if the measured value is above MAX_THRESHOLD then the display is set to
MAX_BRIGHTNESS
MAX_THRESHOLD=400
MAX_BRIGHTNESS=150
LUX_RANGE=`echo "$MAX_THRESHOLD-$MIN_THRESHOLD" | bc`
BRIGHTNESS_RANGE=`echo "$MAX_BRIGHTNESS-$MIN_BRIGHTNESS" | bc`
STEPSIZE=$(echo "scale=2 ; $LUX_RANGE/$BRIGHTNESS_RANGE" | bc -l | cut -f1
-d\.);
# time interval between two measurements
INTERVAL=5
# Debugging ...
echo `date` > $WDIR/deleteme
# Let's wait until pCP is up & running
sleep 20
while true; do
# Measuring the current LUX value
LUX=$($WDIR/lux)
# Calculating the target brightness of the display
if [ $LUX -lt $MIN_THRESHOLD ]; then
TRGT=$MIN_BRIGHTNESS
elif [ $LUX -gt $MAX_THRESHOLD ]; then
TRGT=$MAX_BRIGHTNESS
else
TRGT=$(echo "$MIN_BRIGHTNESS+(($LUX-$MIN_THRESHOLD)/$STEPSIZE)" | bc -l | cut
-f1 -d\.);
fi
# Setting the brightness value of the display
echo $TRGT > /sys/class/backlight/rpi_backlight/brightness
# Uncomment for debugging & testing
# echo $LUX
# echo $TRGT
# Wait some seconds before the next calculation
sleep $INTERVAL
done
--------------------
It because my Raspberry Pi stay in equipment rack.
------------------------------------------------------------------------
WadDad's Profile: http://forums.slimdevices.com/member.php?userid=64557
View this thread: http://forums.slimdevices.com/showthread.php?t=112460
_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix