Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- gpio -g mode 23 in
- gpio -g mode 23 up
- start_time=`date +%s`
- screens_on=0
- while true; do
- if [ `gpio -g read 23` == 1 ]
- then
- if (( screens_on == 0 ))
- then
- cat frame_list | while read frame
- do
- echo "Switching $frame on..."
- sshpass -p raspberry ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no pi@$frame /home/pi/screen_on &
- done
- screens_on=1
- fi
- start_time=`date +%s`
- fi
- sleep 0.8
- now=`date +%s`
- if (( now - start_time >= 600 ))
- then
- cat frame_list | while read frame
- do
- echo "Switching $frame off..."
- sshpass -p raspberry ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no pi@$frame /home/pi/screen_off &
- done
- screens_on=0
- start_time=`date +%s`
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement