Skip to content

Instantly share code, notes, and snippets.

@terakun
Last active October 27, 2016 15:26
Show Gist options
  • Save terakun/41b402e45cbd88a7ebae061e87585250 to your computer and use it in GitHub Desktop.
Save terakun/41b402e45cbd88a7ebae061e87585250 to your computer and use it in GitHub Desktop.
servo
PATTERNFILE=./pattern.txt
echo 0=0% > /dev/servoblaster
echo 1=0% > /dev/servoblaster
sleep 2
ports=(`echo "100 100 100 100 100 100 100 100"`)
while read line; do
ary=(`echo $line`)
port=${ary[0]}
str=`echo "${port}=${ports[$port]}%"`
echo $str > /dev/servoblaster
ports[${port}]=`echo "(${ports[${port}]}+100)%200" | bc`
echo ${ports[${port}]}
sleep ${ary[1]}
done < $FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment