Go Down

Topic: looking for the bare minimum simple serial code so I can modify. (Read 682 times) previous topic - next topic

impellbm

I am using a sabertooth 2x25 to drive two 24v motors. I have successfully used the analog mode with a capacitor resistor circuit. I want to try other methods www.dimensionengineering.com/datasheets/Sabertooth2x25.pdf page 7 shows both rc and simplified serial modes. What can i look at to understand codes better? Thanks
Brian

AWOL

Quote
What can i look at to understand codes better?

That's a subjective question; we don't know what it is that you don't understand.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

impellbm

I want to use the analog read in (Potentiometer) to send serial commands to sabertooth to control direction.

void setup() {
  Serial.begin(9600);
}

void loop() {
  int sensorValue = analogRead(A0);
  Serial.println(sensorValue);
}

This is the bare minimum of code needed to make arduino do something what is the bare minimum code needed to send serial out?

Mode 3: Simplified Serial Mode
Simplified serial uses TTL level single-byte serial commands to set the motor speed and
direction. Simplified serial is a one-direction only
interface. Because Sabertooth controls two motors with one 8 byte character, when operating in Simplified
Serial mode, each motor has 7 bits of resolution. Sending a character between 1 and 127 will
control motor 1. 1 is full reverse, 64 is stop and 127 is full forward. Sending a character between
128 and 255 will control motor 2. 128 is full reverse, 192 is stop and 255 is full forward.
Character 0 (hex 0x00) is a special case. Sending this character will shut down both motors.

PaulS

Quote
This is the bare minimum of code needed to make arduino do something what is the bare minimum code needed to send serial out?

That code above IS the minimum to send serial data.

You need to combine the two 0 to 127 values into one byte, and use Serial.write() to send that byte.


Go Up