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.
ArduinoMath.cpp
- Committer:
- Elefantul_umilit
- Date:
- 2017-02-20
- Revision:
- 0:70797f033fe0
File content as of revision 0:70797f033fe0:
#include "ArduinoMath.h" int ArduinoMath::constrain(int x, int a, int b){ if (x < a) return (a); if (x > b) return (b); return (x); } int ArduinoMath::min(int a, int b){ if (a < b) return (a); return (b); } int ArduinoMath::max(int a, int b){ if (a < b) return (b); return (a); } int ArduinoMath::map(int x, int in_min, int in_max, int out_min, int out_max){ return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; } int ArduinoMath::abs(int x){ if (x < 0) return (-x); return (x); }