Author Topic: Axon and sabertooth 2X10  (Read 3178 times)

0 Members and 1 Guest are viewing this topic.

Offline robotcoderTopic starter

  • Full Member
  • ***
  • Posts: 53
  • Helpful? 0
    • www.RobotCoder.com (underconstruction)
Axon and sabertooth 2X10
« on: August 20, 2009, 11:48:18 PM »
I own an Axon and I am thinking about purchasing a sabertooth 2X10 motor controller to control 2 DC motors and the question is how do I interface between the Axon and the sabertooth.  Can I control the motors by code that is written and loaded on the Axon?

Offline sonictj

  • Supreme Robot
  • *****
  • Posts: 416
  • Helpful? 11
    • Tim's Workshop
Re: Axon and sabertooth 2X10
« Reply #1 on: August 21, 2009, 12:05:29 AM »
Quote
Can I control the motors by code that is written and loaded on the Axon?

Definately.  I have a 2x10 and i have interfaced it via UART, and servo commands to my axon compatible board.  The sabertooth modules are very easy to use and quite powerful.  If you don't mind the cost they are a great investment.

Offline VOne

  • Jr. Member
  • **
  • Posts: 14
  • Helpful? 0
Re: Axon and sabertooth 2X10
« Reply #2 on: November 16, 2009, 11:34:45 PM »
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

Offline robotcoderTopic starter

  • Full Member
  • ***
  • Posts: 53
  • Helpful? 0
    • www.RobotCoder.com (underconstruction)
Re: Axon and sabertooth 2X10
« Reply #3 on: November 16, 2009, 11:52:09 PM »
Thank you for including your code, I will use it.

 


data_list