I have the following script that downloads and processes NOAA satellites. I'd really like some external LEDs to indicate the following;
- When the script is running, turn or blink red
- When the script is not running, turn or blink green
- When the script is within 1 hr of running, turn or blink yellow
I need some assistance in getting a traffic light working WHILE the script is running. I don't know if it's better to call certain other scripts or embed into the existing code (not sure where to do this). I have the LEDs on a breadboard and working fine. Any assistance would be appreciated...thanks.
Further Details on PI GPIO = Red 10, Yellow 9, Green 11
#!/bin/bash
# $1 = Satellite Name
# $2 = Frequency
# $3 = FileName base
# $4 = TLE File
# $5 = EPOC start time
# $6 = Time to capture
# reads and creates folder with current date / time (i.e 05-30-2019_07-48 *windows friendly*)
NOW=$(date +%m-%d-%Y_%H-%M)
mkdir /home/pi/weather/${NOW}
sudo timeout $6 rtl_fm -f ${2}M -s 60k -g 45 -p 55 -E wav -E deemp -F 9 - |
sox -t wav - $3.wav rate 11025
PassStart=`expr $5 + 90`
if [ -e $3.wav ]
then
/usr/local/bin/wxmap -T "${1}" -H $4 -p 0 -l 0 -o $PassStart ${3}-map.png
#/usr/local/bin/wxtoimg -m ${3}-map.png -e ZA $3.wav ${3}.png
#/usr/local/bin/wxtoimg -m ${3}-map.png -e NO $3.wav ${3}.NO.png
#/usr/local/bin/wxtoimg -m ${3}-map.png -e MCIR $3.wav ${3}.MCIR.png
#/usr/local/bin/wxtoimg -m ${3}-map.png -e MSA $3.wav ${3}.MSA.png
fi
#CODE FROM https://forums.qrz.com/index.php?threads/weather-satellite script-help-raspbian.614971/page-7...added 1.17.2020
/usr/local/bin/wxtoimg -m ${3}-map.png -e ZA $3.wav ${3}.png
/usr/local/bin/wxtoimg -m ${3}-map.png -e NO $3.wav ${3}.NO.png
/usr/local/bin/wxtoimg -m ${3}-map.png -e MCIR $3.wav ${3}.MCIR.png
/usr/local/bin/wxtoimg -m ${3}-map.png -e MSA $3.wav ${3}.MSA.png
/usr/local/bin/wxtoimg -m ${3}-map.png -e HVCT $3.wav ${3}.HVCT.png
/usr/local/bin/wxtoimg -m ${3}-map.png -e therm $3.wav ${3}.Thermal.png
/usr/local/bin/wxtoimg -m ${3}-map.png -e JF $3.wav ${3}.JF.png
# copies files to the new folder and deletes the original ones
cp /home/pi/weather/*.png /home/pi/weather/${NOW}/
cd /home/pi//weather/${NOW}/
rm /home/pi/weather/${NOW}/*-map.png
rm /home/pi/weather/*.png
rm /home/pi/weather/*.wav
#END