###AX-12 Python Library (for RaspberryPi)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/
Use it at your own risk. Assume that I have no idea what I am doing.
This is a more object-oriented version of Jesse Merritt's script to control AX-12 servos using a Raspberry Pi.
The script assumes that the Raspberry Pi is connected to the servos through a buffer such as a 74HC241. The communication direction is controlled through GPIO pin 18, and Serial communication Rx and Tx through GPIO pins 15 and 14, respectivelly.
A schematic for the circuit can be found on page 8 of the AX-12 manual.
The startup config of the Raspberry Pi has to be modified to set the UART clock to allow for 1Mbps baud. The TTY attached to the COM port has to be disabled, and the baud rate of the TTY has to be set to 1Mbps.
Add the following line to /boot/config.txt:
Edit /boot/cmdline.txt and remove all options mentioning ttyAMA0.
Edit /etc/inittab and comment out any lines mentioning ttyAMA0.
Add the following line to ~/.bashrc:
sudo stty -F /dev/ttyAMA0 1000000