SyRen/Sabertooth Packet Serial Library for Arduino
Control your SyRen or Sabertooth with reliable Packet Serial.
3.Advanced/SoftwareSerial/SoftwareSerial.ino

Uses a pin other than TX to connect to S1.

// Software Serial Sample for Packet Serial
// Copyright (c) 2012 Dimension Engineering LLC
// See license.txt for license details.
#include <SoftwareSerial.h>
#include <Sabertooth.h>
SoftwareSerial SWSerial(NOT_A_PIN, 11); // RX on no pin (unused), TX on pin 11 (to S1).
Sabertooth ST(128, SWSerial); // Address 128, and use SWSerial as the serial port.
void setup()
{
SWSerial.begin(9600);
ST.autobaud();
}
void loop()
{
int power;
// Ramp from -127 to 127 (full reverse to full forward), waiting 20 ms (1/50th of a second) per value.
for (power = -127; power <= 127; power ++)
{
ST.motor(1, power);
delay(20);
}
// Now go back the way we came.
for (power = 127; power >= -127; power --)
{
ST.motor(1, power);
delay(20);
}
}