Code to check RPi GPIO Inputs via bash
##note pin 4 has to be set as an input
#!/bin/bash
while true
do
sleep .01
#echo "Checking Button; hit [CTRL+C] to stop!"
trigger=$(sudo cat /sys/class/gpio/gpio4/value)
if [ $trigger = "0" ]; then
echo "button pressed"
fi
done
#!/bin/bash
while true
do
sleep .01
#echo "Checking Button; hit [CTRL+C] to stop!"
trigger=$(sudo cat /sys/class/gpio/gpio4/value)
if [ $trigger = "0" ]; then
echo "button pressed"
fi
done
Comments
Post a Comment