I have a led connected to a gpio pin using wiringpi, and I am trying to have it affected by the temperature reported by
I have this command in an executable file so that it can be referenced elsewhere more simply, and its output is like this:
What I am doing is utilizing this output to affect an led I have connected to pin 17 (or pin 0 in wiringpi). The led itself works, as does the majority of this script:
Removed to create space for complete code.
However, this seems to only trigger the first part of the if, and never runs any other part of the script.
Any help will be appreciated.
EDIT: Code now works, thanks all for the help:
#!/bin/bash a=1 b=0 temp=$(temp | cut -c 6-7) while [[ $a > $b ]] do if [[ $(temp | cut -c 6-7) > 51 ]]; then echo "temp over 50" temp gpio write 0 1 sleep 0.5 gpio write 0 0 sleep 0.5 #echo "actual temp is" #temp elif [[ $(temp | cut -c 6-7) < 52 ]]; then echo "temp under 50" temp gpio write 0 1 sleep 0.1 gpio write 0 0 sleep 0.9 #echo "actual temp is" #temp else echo "temp is 50" temp gpio write 0 1 sleep 0.2 gpio write 0 0 sleep 0.8 fi done