Created
April 23, 2022 14:48
-
-
Save ceccocats/16a89e2745729245e934658e0a98d265 to your computer and use it in GitHub Desktop.
command DollaTek LCUS usb relay
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
#! /bin/bash | |
stty -F /dev/ttyUSB0 9600 | |
while [[ $# -gt 0 ]]; do | |
case $1 in | |
--on) | |
echo "set on" | |
echo -e "\xA0\x01\x01\xA2" > /dev/ttyUSB0 | |
shift | |
;; | |
--off) | |
echo "set off" | |
echo -e "\xA0\x01\x00\xA1" > /dev/ttyUSB0 | |
shift | |
;; | |
-h|--help) | |
echo "usage: $0 [--on|--off]" | |
shift | |
;; | |
-*|--*) | |
echo "Unknown option $1" | |
exit 1 | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Amazing, works perfectly for me!