Hi all, I have sabertooth 2x60 which I am using for a trailer tug. My problem is that ramping is not occuring as I thought it would. The code is a modified example from dimension engineering. The green comments are what its supposed to do, red are when it didnt ramp and blue are when it did. I hope this is easier to read than my previous post
// 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 runf;
int runb;
[color=green] //motor1 and motor2 Ramp from 0 to 127 (stop to full forward), waiting 20 ms (1/50th of a second) per value.unit goes forward[/color]
for (runf = 0; runf <= 127; runf ++);
{
ST.motor(1, runf)[color=red];//motors start but do not ramp[/color]
ST.motor(2, runf);
delay(20);
}
delay(20000);
[color=green] //motor1 and motor2 Ramp from 0 to -127 (stop to full reverse), waiting 20 ms (1/50th of a second) per value.unit goes backwards[/color]
for (runb = 0; runb >= -127; runb --)
{
ST.motor(1, runb);[color=blue]//motors start with ramp[/color]
ST.motor(2, runb);
delay(20);
}
delay(20000);
[color=green]//motor1 ramps from 0 - 127 motor2 ramps from 0 - -127 waiting 20 ms (1/50th of a second) per value.unit spins CCW[/color]
for (runf = 0; runf <= 127; runf ++); for (runb = 0; runb >= -127; runb --)
{
ST.motor(1, runf);[color=red]// motor starts no ramp[/color]
ST.motor(2, runb);[color=blue]//motor starts with ramp[/color]
delay(20);
}
delay(2000);
[color=green]//motor1 ramps from 0 - -127 motor2 ramps from 0 - 127 waiting 20 ms (1/50th of a second) per value.unit spins CW[/color]
for (runf = 0; runf <= 127; runf ++); for (runb = 0; runb >= -127; runb --)
{
ST.motor(1, runb);[color=blue]//motor starts with ramp[/color]
ST.motor(2, runf);[color=red]// motor starts no ramp[/color]
delay(20);
}
delay(2000);
}
Any help or ideas would appreciated