Library for Sabertooth motor driver ported from the oficial Arduino library. Packetized Serial Mode

I ported the official arduino library for Sabertooth dual motor drivers. In the porting process I did not used const methods as the original library does, but the functionality stays the same. I also added some methods that I find useful. According to the documentation of the driver this code should be compatible with SyRen drivers.

Files at this revision

API Documentation at this revision

Comitter:
Elefantul_umilit
Date:
Thu Sep 21 12:32:29 2017 +0300
Parent:
0:70797f033fe0
Commit message:
solved bug in setBaudRate. Now the baud is updated on the mcu as well

Changed in this revision

Sabertooth.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 70797f033fe0 -r 013fa8604413 Sabertooth.cpp
--- a/Sabertooth.cpp	Mon Feb 20 11:10:08 2017 +0000
+++ b/Sabertooth.cpp	Thu Sep 21 12:32:29 2017 +0300
@@ -127,12 +127,13 @@
   switch (baudRate)
   {
   case 2400:           value = 1; break;
-  case 9600:  default: value = 2; break;
+  case 9600:  default: value = 2; baudRate = 9600; break;
   case 19200:          value = 3; break;
   case 38400:          value = 4; break;
   case 115200:         value = 5; break;
   }
   command(15, value);
+  _sabertoothserial.baud(baudRate);
   // Sabertooth takes about 200 ms after setting the baud rate to
   // respond to commands again (it restarts).
   // So, this 500 ms wait should deal with this.