Skip to content

Instantly share code, notes, and snippets.

@ceccocats
Created April 23, 2022 14:48
Show Gist options
  • Save ceccocats/16a89e2745729245e934658e0a98d265 to your computer and use it in GitHub Desktop.
Save ceccocats/16a89e2745729245e934658e0a98d265 to your computer and use it in GitHub Desktop.
command DollaTek LCUS usb relay
#! /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
@MortenStabenau
Copy link

Amazing, works perfectly for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment