Pages: [1]   Go Down
Author Topic: looking for the bare minimum simple serial code so I can modify.  (Read 539 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 241
Posts: 24480
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

"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.

Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 553
Posts: 46300
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thank you
Logged

Pages: [1]   Go Up
Jump to: