Hi All,
I just had a question about the code for the Axon and Sabertooth, and I reliazed I have never posted any of it, so here is my quick code dump:
I connected the Sabertooth to the UART 2 connector, and using the UART protocol to communicate with it ... so, initialize the UARTH like this:
//G=Ground, T=Tx (connect to external Rx), R=Rx (connect to external Tx)
uartSetBaudRate(2, 38400); // set UARTH speed; SABERTOOTH
Admin has already included this function in sensor.c, which works perfectly, of course:
/************SABERTOOTH*******************/
void sabertooth(int m1, int m2)
{
//rprintfInit(uart2SendByte);//select uart2
uart2SendByte(m1);//send a command for motor 1
uart2SendByte(m2);//send a command for motor 2
}
Which I call from my main program, like this backup routing:
void Backup(int Time){
//Backup for Time in ms: Stop, Backup
sabertooth(64,192); //Stop
delay_ms(50); //Pause
sabertooth(64-50,192-50);//Bakup
delay_ms(Time);
}
OR
void SpinRight(int Time)
{
sabertooth(64+50,192-50);
delay_ms(Time);
}
I hope that help someone else ...
VOne