View source
From HobbyVex
for
VEX Control Libs
Jump to:
navigation
,
search
I have created a few scripts for controlling a VEX micro controller connected to a linux host. ==vexphp== I have created a simple class of PHP functions for doing fun things like controlling your robot via a http interface. For more information visit [http://code.google.com/p/vexphp/ vexphp at google code] ==bash script== Here is a quick bash script that can be used to configure your serial port and do some testing. <pre> TTY=/dev/ttyS0 PORT=$[$2-1] if [ ! $1 ]; then echo Usage: echo "vex [device] [number] [command] eg: vex port 1 on OR vex motor 2 down" echo "vex [command] (prepare,init,exit,reset)" exit fi if [ $1 = "prepare" ]; then stty -F $TTY 115200 -parenb -parodd cs8 -hupcl -cstopb cread clocal -crtscts \ ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8 \ -opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 \ -isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke \ min 1 time 5 elif [ $1 = "init" ]; then echo -e "\xc9\x17\x01\x00\x00\x00" > $TTY elif [ $1 = "exit" ]; then echo -e "\xc9\x17\x02\x00\x00\x00" > $TTY elif [ $1 = "reset" ]; then echo -e "\xc9\x17\x03\x00\x00\x00" > $TTY elif [ $1 = "motor" ]; then if [ $3 = "up" ]; then echo -e "\xc9\x17\x04\x0$PORT\x00\x00" > $TTY elif [ $3 = "off" ]; then echo -e "\xc9\x17\x04\x0$PORT\x7f\x00" > $TTY elif [ $3 = "down" ]; then echo -e "\xc9\x17\x04\x0$PORT\xff\x00" > $TTY else echo "options are up/off/down" fi elif [ $1 = "port" ]; then if [ $3 = "on" ]; then echo -e "\xc9\x17\x06\x0$PORT\x01\x00" > $TTY elif [ $3 = "off" ]; then echo -e "\xc9\x17\x06\x0$PORT\x00\x00" > $TTY else echo "options are on/off" fi else echo Usage: echo "vex [device] [number] [command] eg: vex port 1 off" echo "vex [command] (prepare,init,exit,reset)" fi </pre> [[Category:Software]]
Return to
VEX Control Libs
.
Views
Page
Discussion
View source
History
Personal tools
Log in
Navigation
Main Page
Community portal
Current events
Recent changes
Random page
Help
Search
Toolbox
What links here
Related changes
Special pages