Created
December 24, 2018 01:53
-
-
Save hfuller/fa9dfcc14bc4a478ebf39564e398ae70 to your computer and use it in GitHub Desktop.
Using a RS232 pin as a binary sensor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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