Sabertooth motor control

I have been working on building a self balancing robot from a project on instrucibles.
Aside from some blink & other simple tutorials, this is my first big adruino project. It seemed pretty simple to accomplish even with a limited knowledge as they all do until you need to troubleshoot.
Its not working for me. I originally had an include error when compiling the code. I believe i fixed it by adding the line #include <SoftwareSerial.h>
I no longer get an error& the motor bumps when I first plug it in. I can't get any more action that that.
I found some other motor tests on various sites & mine seem to be working.
I cant figure out where to take the troubleshooting. I think I would want to force a signal from the gyro in code to see if that makes it run. That way I would know if my prob was with that part.
Can anyone help with how I might do that.
the project is:


I think I would want to force a signal from the gyro in code to see if that makes it run.

What gyro ? I don’t see a gyro on the parts list .
We need to see your code (copy & pasted from your IDE) . We know the code on the site is good but we need to see the code you are actually running (copied from your IDE window), even if it is IDENTICAL. That’s how we roll here…
Additionally, we would need photos of YOUR hardware, not someone else’s , even if it is IDENTICAL. Please take photos that show enough detail to check wiring . If necessary , take several. Additionally, we need to know some basic info (like the voltage on your battery . When you last charged the battery. Is it nicad, lipo, or what ? Is it new ? Is it an old battery you pulled out of the garage from when you were a teenager ? As I understand it the SITREP (Situation Report) is that you have ruled out the battery , motors, and motor driver by performing some tests. Your arduino work fine because you have run some basic tests (like the Blink Example) to verify it is not bricked or otherwise messed up. I have no idea what you mean by gyro because the ADXL335 is not a gyro. You are running the Sabertooth in serial mode using Software Serial. Have you run this Example sketch ?

 // Simple Example Sample
// Copyright (c) 2012 Dimension Engineering LLC
// See license.txt for license details.
#include <SabertoothSimplified.h>
SabertoothSimplified ST; // We'll name the Sabertooth object ST.
                         // For how to configure the Sabertooth, see the DIP Switch Wizard for
                         // Be sure to select Simplified Serial Mode for use with this library.
                         // This sample uses a baud rate of 9600.
                         // Connections to make:
                         //   Arduino TX->1  ->  Sabertooth S1
                         //   Arduino GND    ->  Sabertooth 0V
                         //   Arduino VIN    ->  Sabertooth 5V (OPTIONAL, if you want the Sabertooth to power the Arduino)
                         // If you want to use a pin other than TX->1, see the SoftwareSerial example.
void setup()
  SabertoothTXPinSerial.begin(9600); // This is the baud rate you chose with the DIP switches.
void loop()
  ST.motor(1, 127);  // Go forward at full power.
  delay(2000);       // Wait 2 seconds.
  ST.motor(1, 0);    // Stop.
  delay(2000);       // Wait 2 seconds.
  ST.motor(1, -127); // Reverse at full power.
  delay(2000);       // Wait 2 seconds.
  ST.motor(1, 0);    // Stop.

Thank you for responding. I did mean analog accel. I will add my code to the end of this reply & attach a couple of photos of the wiring. All parts are brand new. I bought everything for this project. The bat is 7.2 Nicad with a strong fresh charge.
I am running in saber serial mode & have the switches set up for 9600 according to sabers dip tool. I have them as on-off-on-off-on-on
I do seem to have intermittent operation of the motors with different saber test codes. Sometimes the first motor will start & not stop. Sometimes it runs as programmed except the delays are much longer than 2 seconds..more then even 2 minutes.

You will see in the wiring pics that I have the blue wire signal to saber connected to another wire. I did that because originally I had the 22awg wire that is soldered to the saber board directly inserted into the arduino which although makes a good connection I thought could be the prob so I changed it with no effect.
Thank you again for your help.

I can't find the common ground between the Saber and the arduino . Is it there ? Where ? Take a photo showing a pointer or label identifying it's location.

See attached pic. I highlighted the ground going from saber to gnd on arduino

I did mean analog accel. I will add my code to the end of this reply

And ?

Does the Blue error led come on at all ?
I need to know all your settings for the OTHER dipswitch and what they represent.(I don’t see anything in the tutorial for these)


I have not seen the blue LED come on at any time except when I am running some of the test sketches and the motors are not connected to the main battery, so they are running off usb power. In that case, if the wheel has resistance the saber shows error. but if I switch to the nicad bat that does not happen. Im sure its just an over current error.

My dips are set as 1-6: on, off, on, off, on, on further down in the comments someone asks how he has the DIPS
Saber has a dip swithc wizrd Sabertooth 2X25, 2X12 and 2X5 DIP switch configuration wizard
Here is mine result of the wizrd Sabertooth DIP switch configuration wizard
The I used the 9600 set up.

I have signal coming from pin 13 to the s1 on saber. This is shown in a photo. He mentions the rx to pin 12 in the code by remarks that it is not used.
I do not have it connected. Maybe my problem…

Here is my code:

#include <SoftwareSerial.h>
int x, r, l, s, f, xa, xb, xc;

//Digital pin 13 is serial transmit pin to sabertooth
#define SABER_TX_PIN  13
//Not used but still initialised, Digital pin 12 is serial receive from Sabertooth
#define SABER_RX_PIN  12
//set baudrate to match sabertooth dip settings
#define SABER_BAUDRATE  9600
SoftwareSerial SaberSerial = SoftwareSerial (SABER_RX_PIN, SABER_TX_PIN );

void initSabertooth (void)  {
  //communicate with sabertooth
SaberSerial.begin( SABER_BAUDRATE );

void setup()                    // run once, when the sketch starts

void set_motor()   {
  x = analogRead(0);       // read analog input pin 0

//x range is about 270-400 and flat is about 330
//smooth x by averaging 3 readings of x
xa = x;
delay (20);
x = analogRead(0);     
xb = x;
delay (20);
x = analogRead(0);      
xc = x;
x= (xa +xb + xc)/3;


//s=slope with less being more aggressive
s = 1.8  ;
//f=fudge factor
f = 5;

//stable x around 330
if ((x > 325) && (x < 335)) {
r = 62;
l = 194;
//drive forward at a steady speed if leaning forward a little 310 > x < 330
if ((x > 310) && (x < 326)) {
r = 45;
l = 167;
//if falling forward more increase speed linearly for 279 > x < 311
if ((x > 279) && (x < 311)) {
//higher values make it faster
r = s * x - 278 + f;
l = s * x - 148 + f;
//if full forward x < 280
if ((x > 250) && (x < 280)) {
r = 6;
l = 133;
// drive backward at a steady speed if leaning back a little 334 > x > 349
if ((x > 334) && (x < 349)) {
r = 78;
l = 208;
//if falling backwords more increase speed linearly for 348 < x < 390
if ((x > 348) && (x < 391)) {
//lower values make it faster
r = s * x - 270 + f;
l = s * x - 140 + f;
//if full backwords 390 < x
if ((x > 390) && (x < 410)) {
r = 122;
l = 250;

//send motor outputs to sabertooth


void loop ()  {
float level = 0;

int u;

} // end loop

When I asked about the OTHER DIP switch I DON'T nean Baud rate. I mean Motor driver setup.
READ the Sabertooth manual.
Connect PIN 12. Don't tell me your following a tutorial and then I find you are ignoring instructions.