Right now I have a rc robot with a Sabertooth dual 25A motor driver, and I just bought a parallax discovery kit with the basic stamp 2 micro controller. I am trying to write a program that looks something like this for a differential drive
pseudocode:
if bumper switch is open
drive straight until switch closes
if switch closes
pause
back up
rotate
and loop
The saber tooth looks like there is 2 ways to do it
#1) Mode 1: Analog Input
Analog input mode takes one or two analog inputs and uses those to set the speed and direction
of the motor. The valid input range is 0v to 5v. This makes the Sabertooth easy control using a
potentiometer, the PWM output of a microcontroller (with an RC filter) or an analog circuit.
Major uses include joystick or foot-pedal controlled vehicles, speed and direction control for
pumps and machines, and analog feedback loops.
#2) Simplified Serial Mode
Simplified serial uses TTL level single-byte serial commands to set the motor speed and
direction. This makes it easy to interface to microcontrollers and PCs, without having to
implement a packet-based communications protocol. Simplified serial is a one-direction only
interface. The transmit line from the host is connected to S1. The host’s receive line is not
connected to the Sabertooth. Because of this, multiple drivers can be connected to the same serial
transmitter. If using a true RS-232 device like a PC’s serial port, it is necessary to use a level
converter to shift the –10V to 10V rs-232 levels to the 0v-5v TTL levels the Sabertooth is
expecting. This is usually done with a Max232 type chip. If using a TTL serial device like a
microcontroller, the TX line of the microcontroller may be connected directly to S1.
Because Sabertooth controls two motors with one 8 byte character, when operating in Simplified
Serial mode, each motor has 7 bits of resolution. Sending a character between 1 and 127 will
control motor 1. 1 is full reverse, 64 is stop and 127 is full forward. Sending a character between
128 and 255 will control motor 2. 128 is full reverse, 192 is stop and 255 is full forward.
Character 0 (hex 0x00) is a special case. Sending this character will shut down both motors.
Which is easier? I would like to use choice #2 but I am not sure how to get the basic stamp to output numbers to control the motors?
As for the first way I dont even know where to start
Thanks-John