Friday, February 3, 2012

Arduino + Sabertooth 2x10 motor controller


Contrary to what i saw online, regular Arduino Duemilanove's PWM frequency is enough to drive one accu-drill motor using the Sabertooth 2x10. Following is the test code i developed for it. Next step is to try it with two motors, and the possibilities of differential drive, and incorporating the encoder wheels to provide the robot brain with the traveling distance sense.

int wvout = 9;
int val = 0;

void setup()
{
Serial.begin(9600);
pinMode(wvout, OUTPUT);
}

void loop(){
val=analogRead(0);
val=map(val,0,1023,0,255);
Serial.println(val);
analogWrite(wvout,val);
delay(1000);
}