Skip to content

Instantly share code, notes, and snippets.

@adventureloop
Created October 28, 2016 11:14
Show Gist options
  • Select an option

  • Save adventureloop/f66ba7abe800c6e208c94c8d50918fed to your computer and use it in GitHub Desktop.

Select an option

Save adventureloop/f66ba7abe800c6e208c94c8d50918fed to your computer and use it in GitHub Desktop.
#!/usr/bin/env zsh
#device=$2
device=/dev/cuaU0
case "$1" in
"off")
echo -n "\x00" > $device
;;
"colour")
echo -n "\x01\xFF\xFF\xFF" > $device
;;
"count")
echo -n "\x10" > $device
;;
"rainbow")
echo -n "\x11" > $device
;;
"alert")
echo -n "\x12\xFF\x00\x00" > $device
sleep 3
echo -n "\x01\xFF\xFF\xFF" > $device
;;
"enablepixels")
#echo -n "\x13\xFF\xFF\xFF\x01\x00\x01\x00\x01\x00\x01\x00\x01" > $device
echo -n "\x13\xFF\xFF\xFF\x01\x01\x01\x01" > $device
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment