We have a functional program but noticed the distances vary in forward and reverse with a brush motor 350W - 24volt system.
Anyone ever run into a solution for that?
// program goes in Reveerse for 20 feet - 4 seconds then forward for 25 feet - 4 seconds-NOT SURE WHAT CAUSES THIS YET!
#include <Servo.h>
Servo ST1; // We'll name the Sabertooth servo channel objects ST1 and ST2.
// For how to configure the Sabertooth, see the DIP Switch Wizard for
// Sabertooth 2X25, 2X12 and 2X5 DIP switch configuration wizard
// Be sure to select RC Microcontroller Mode for use with this sample.
//
// Connections to make:
// Arduino Pin 9 -> Sabertooth S1
// Arduino Pin 10 -> Sabertooth S2
// Arduino GND -> Sabertooth 0V
// Arduino VIN -> Sabertooth 5V (OPTIONAL, if you want the Sabertooth to power the Arduino)
//
// Sabertooth accepts servo pulses from 1000 us to 2000 us.
// Delay 1000=1 second
// We need to specify the pulse widths in attach(). 0 degrees will be full reverse, 180 degrees will be
// full forward. Sending a servo command of 90 will stop the motor. Whether the servo pulses control
// the motors individually or control throttle and turning depends on your mixed mode setting.
//110 =2.5 seconds of runtime with a 20ms delay = 1/50th of a second
// Notice these attach() calls. The second and third arguments are important.
// With a single argument, the range is 44 to 141 degrees, with 92 being stopped.
// With all three arguments, we can use 0 to 180 degrees, with 90 being stopped.
void setup()
{
ST1.attach( 9, 1000, 2000);
}
void loop()
{
delay(5000);
// delay of 5000 = 5 seconds
int power;
//intialize power
// Ramp both servo channels from 0 to 180 (full reverse to full forward),
// waiting 20 ms (1/50th of a second) per value.
for (power = 0; power <= 180; power ++)
{
ST1.write(power);
delay(20);
// delay of 50 runtime = 4 seconds
}
// Now go back the way we came.change this setting tommorrow to slow down reverse
for (power = 180; power >= 0; power --)
{
ST1.write(power);
delay(20);
//Now motor stops and program does not loop
//for (power = 90; power <= 90;)
//ST1.write(power);
//delay(50);
}
}