Go Down

Topic: Serial Comunication issues Saberthooth motor driver (Read 281 times) previous topic - next topic


I am having some unexpected issues with trying to have my Arduino Mega communicate via serial using the TX ports.  I am currently verifying which serial output is used since the example program specifies TX1.  Uploading the program results on no output over the TX1.  I am able to see an output over the serial monitor and the TX light is flashing.

Running the Arduino off an external power source, I have noticed that the TX light no longer blinks and it acts as if I never uploaded the program.

Am missing something?  I verified that all input voltages are correct as well as the proper dim switches are configured on the motor controller.

My hardware configuration is set up as specified in the sample code.

Code: [Select]
// Tank-Style Sweep Sample
// Copyright (c) 2012 Dimension Engineering LLC
// See license.txt for license details.

#include <SabertoothSimplified.h>

// Mixed mode is for tank-style diff-drive robots.
// Only Packet Serial actually has mixed mode, so this Simplified Serial library
// emulates it (to allow easy switching between the two libraries).

SabertoothSimplified ST; // We'll name the Sabertooth object ST.
                         // For how to configure the Sabertooth, see the DIP Switch Wizard for
                         //   http://www.dimensionengineering.com/datasheets/SabertoothDIPWizard/start.htm
                         // 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.             
  ST.drive(0); // The Sabertooth won't act on mixed mode until
  ST.turn(0);  // it has received power levels for BOTH throttle and turning, since it
               // mixes the two together to get diff-drive power levels for both motors.
               // So, we set both to zero initially.

// Mixed mode tips:
//   drive() should go forward and back, turn() should go right and left.
//     If this is reversed, swap M2A and M2B.
//   Positive on drive() should go forward, negative should go backward.
//     If this is reversed, swap A and B on both M1 and M2.
//   Positive on turn() should go right, negative should go left.
//     If this is reversed, swap M1 and M2.

// In this sample, the SLOW sweep (left-to-right) here is turning,
// and the FAST sweep (backwards-to-forwards) is throttle.
void loop()
  int power;
  // Don't turn. Ramp from going backwards to going forwards, waiting 20 ms (1/50th of a second) per value.
  for (power = -127; power <= 127; power ++)
  // Now, let's use a power level of 20 (out of 127) forward.
  // This way, our turning will have a radius. Mostly, the command
  // is just to demonstrate you can use drive() and turn() at the same time.
  // Ramp turning from full left to full right SLOWLY by waiting 50 ms (1/20th of a second) per value.
  for (power = -127; power <= 127; power ++)
  // Now stop turning, and stop driving.
  // Wait a bit. This is so you can catch your robot if you want to. :-)


Uploading the program results on no output over the TX1.
And you know that how?

Am missing something?
Yep. The TX light is NOT controlled by the Mega. It is controlled by the USB to Serial chip. With nothing connected to the USB side of the chip, nothing gets sent, so the TX light doesn't blink. It doesn't matter that the Arduino is sending War And Peace to the USB-to-serial converter.

Post a schematic AND a photo of your actual setup.
The art of getting good answers lies in asking good questions.

Go Up