Hi I am trying to build a four wheeled mechanum robot with arduino mega and sabertooth driver2X12.
I am new to arduino and its programming I have set up the robot mechanically.
1> I am trying to move the wheels independently such that one driver controls 2 motors.
I uploaded the program from the sabertooth library but the thing when I upload only one wheel will follow the instructions and the other will keep on moving independently only in one direction.
Sabertooth ST1[2] = { Sabertooth(128), Sabertooth(129) };
Sabertooth ST2(130);
void setup()
{
SabertoothTXPinSerial.begin(9600);
//Sabertooth::autobaud(SabertoothTXPinSerial); // Autobaud is for the whole serial line -- you don't need to do
// it for each individual motor driver. This is the version of
// the autobaud command that is not tied to a particular
// Sabertooth object.
// See the examples in 1.Basics for information on whether you
// need this line at all.
}
void loop()
{
// ST1[0] (address 128) has power 50 (of 127 max) on M1,
// ST1[1] (address 129) has power 60 (of 127 max) on M2, and
Serial.println("first loop motor1");
ST1[0].motor(1, 10);
delay(100);
Serial.println("second loop motor 2");
ST1[1].motor(2, 10);
delay(3000);
Serial.println("second loop motor 1");
ST1[0].motor(1, 0);
delay(100);
Serial.println("second loop motor 2");
ST1[1].motor(2, 0);
delay(3000);
}
I am trying this code with simple serial mode dip switch 1 3 5 on from sabertooth. When I run this code the motor will keep on running and the second motor will run and stop properly and if I change to ST1[1].motor(2, -10); the second motor will turn in opposite direction but for the first motor it wont
And for the output I am getting as attached, can anyone please let me know how to control the sabertooth to run the 2 motors independently in both the directions.
Thank you in advance.