Skip to content

Instantly share code, notes, and snippets.

@hfuller
Created December 24, 2018 01:53
Show Gist options
  • Save hfuller/fa9dfcc14bc4a478ebf39564e398ae70 to your computer and use it in GitHub Desktop.
Save hfuller/fa9dfcc14bc4a478ebf39564e398ae70 to your computer and use it in GitHub Desktop.
Using a RS232 pin as a binary sensor
PIN="Clear To Send"
while true; do
statserial /dev/ttyUSB0 -n | grep -qE "0\s+$PIN"
echo $? | sed -e 's/0/false/' -e 's/1/true/'
sleep 0.5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment