Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3946

Troubleshooting • Reading a pin state and selecting (either/or) between two entries in a chron file

$
0
0
I built an MLB scoreboard with a RPI 3. Right now the display can either show my favorite teams playing, OR all the teams playing and cycle through them as they are going on. I would like to add a toggle switch to the back of the scoreboard to select either the favorite teams or all teams depending on who's playing at that time. I have two separate nearly identical directories for the scoreboard accommodating either All-Teams or My-Teams.

Right now I have a cron file called "start-scoreboard.sh" that will start the score board showing either All-Teams, or My-Teams depending on what I have entered into "cd /home/pi/mlb-led-scoreboard-All-Teams" within the cron file.

Is there a way for the RPI to read the state of a gpio pin and run the All-Teams OR My-Teams directories? Here is what I have in my "start-scoreboard.sh" cron file...

#!/bin/bash
u/reboot sleep 60 $$ start-scoreboard.sh

cd /home/pi/mlb-led-scoreboard-All-Teams

n=0

until [ $n -ge 10 ]

do

python main.py --led-gpio-mapping=adafruit-hat --led-brightness=50 --led-slowdown-gpio=3 --led-rows=32 --led-cols=64 && break

n=$[$n+1]

sleep 10

done

Statistics: Posted by SwannyRiver — Sun Apr 14, 2024 2:09 am



Viewing all articles
Browse latest Browse all 3946

Trending Articles