Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
Sabertooth Class Reference

Controls a Sabertooth or SyRen motor driver running in Packet Serial mode. More...

#include <Sabertooth.h>

List of all members.

Public Member Functions

byte address () const
void autobaud (boolean dontWait=false) const
void command (byte command, byte value) const
void drive (int power) const
void motor (int power) const
void motor (byte motor, int power) const
SabertoothStreamport () const
 Sabertooth (byte address)
 Sabertooth (byte address, SabertoothStream &port)
void setBaudRate (long baudRate) const
void setDeadband (byte value) const
void setMaxVoltage (byte value) const
void setMinVoltage (byte value) const
void setRamping (byte value) const
void setTimeout (int milliseconds) const
void stop () const
void turn (int power) const

Static Public Member Functions

static void autobaud (SabertoothStream &port, boolean dontWait=false)

Private Member Functions

void throttleCommand (byte command, int power) const

Private Attributes

const byte _address
SabertoothStream_port

Detailed Description

Controls a Sabertooth or SyRen motor driver running in Packet Serial mode.

Definition at line 41 of file Sabertooth.h.


Constructor & Destructor Documentation

Sabertooth::Sabertooth ( byte  address)

Initializes a new instance of the Sabertooth class. The driver address is set to the value given, and the Arduino TX serial port is used.

Parameters:
addressThe driver address.

Definition at line 21 of file Sabertooth.cpp.

Sabertooth::Sabertooth ( byte  address,
SabertoothStream port 
)

Initializes a new instance of the Sabertooth class. The driver address is set to the value given, and the specified serial port is used.

Parameters:
addressThe driver address.
portThe port to use.

Definition at line 27 of file Sabertooth.cpp.


Member Function Documentation

byte Sabertooth::address ( ) const [inline]

Gets the driver address.

Returns:
The driver address.

Definition at line 64 of file Sabertooth.h.

void Sabertooth::autobaud ( boolean  dontWait = false) const

Sends the autobaud character.

Parameters:
dontWaitIf false, a delay is added to give the driver time to start up.

Definition at line 33 of file Sabertooth.cpp.

void Sabertooth::autobaud ( SabertoothStream port,
boolean  dontWait = false 
) [static]

Sends the autobaud character.

Parameters:
portThe port to use.
dontWaitIf false, a delay is added to give the driver time to start up.

Definition at line 38 of file Sabertooth.cpp.

void Sabertooth::command ( byte  command,
byte  value 
) const

Sends a packet serial command to the motor driver.

Parameters:
commandThe number of the command.
valueThe command's value.

Definition at line 48 of file Sabertooth.cpp.

void Sabertooth::drive ( int  power) const

Sets the driving power.

Parameters:
powerThe power, between -127 and 127.

Definition at line 73 of file Sabertooth.cpp.

void Sabertooth::motor ( int  power) const

Sets the power of motor 1.

Parameters:
powerThe power, between -127 and 127.

Definition at line 62 of file Sabertooth.cpp.

void Sabertooth::motor ( byte  motor,
int  power 
) const

Sets the power of the specified motor.

Parameters:
motorThe motor number, 1 or 2.
powerThe power, between -127 and 127.

Definition at line 67 of file Sabertooth.cpp.

SabertoothStream& Sabertooth::port ( ) const [inline]

Gets the serial port.

Returns:
The serial port.

Definition at line 70 of file Sabertooth.h.

void Sabertooth::setBaudRate ( long  baudRate) const

Sets the baud rate. Baud rate is stored in EEPROM, so changes persist between power cycles.

Parameters:
baudRateThe baud rate. This can be 2400, 9600, 19200, 38400, or on some drivers 115200.

Definition at line 99 of file Sabertooth.cpp.

void Sabertooth::setDeadband ( byte  value) const

Sets the deadband. Deadband is stored in EEPROM, so changes persist between power cycles.

Parameters:
valueThe deadband value. Motor powers in the range [-deadband, deadband] will be considered in the deadband, and will not prevent the driver from entering nor cause the driver to leave an idle brake state. 0 resets to the default, which is 3.

Definition at line 129 of file Sabertooth.cpp.

void Sabertooth::setMaxVoltage ( byte  value) const

Sets the maximum voltage. Maximum voltage is stored in EEPROM, so changes persist between power cycles.

Parameters:
valueThe voltage. The units of this value are driver-specific and are specified in the Packet Serial chapter of the driver's user manual.

Definition at line 94 of file Sabertooth.cpp.

void Sabertooth::setMinVoltage ( byte  value) const

Sets the minimum voltage.

Parameters:
valueThe voltage. The units of this value are driver-specific and are specified in the Packet Serial chapter of the driver's user manual.

Definition at line 89 of file Sabertooth.cpp.

void Sabertooth::setRamping ( byte  value) const

Sets the ramping. Ramping is stored in EEPROM, so changes persist between power cycles.

Parameters:
valueThe ramping value. Consult the user manual for possible values.

Definition at line 134 of file Sabertooth.cpp.

void Sabertooth::setTimeout ( int  milliseconds) const

Sets the serial timeout.

Parameters:
millisecondsThe maximum time in milliseconds between packets. If this time is exceeded, the driver will stop the motors. This value is rounded up to the nearest 100 milliseconds. This library assumes the command value is in units of 100 milliseconds. This is true for most drivers, but not all. Check the packet serial chapter of the driver's user manual to make sure.

Definition at line 139 of file Sabertooth.cpp.

void Sabertooth::stop ( ) const

Stops.

Definition at line 83 of file Sabertooth.cpp.

void Sabertooth::throttleCommand ( byte  command,
int  power 
) const [private]

Definition at line 56 of file Sabertooth.cpp.

void Sabertooth::turn ( int  power) const

Sets the turning power.

Parameters:
powerThe power, between -127 and 127.

Definition at line 78 of file Sabertooth.cpp.


Member Data Documentation

const byte Sabertooth::_address [private]

Definition at line 175 of file Sabertooth.h.

Definition at line 176 of file Sabertooth.h.


The documentation for this class was generated from the following files:


ric_mc
Author(s): RoboTiCan
autogenerated on Thu Aug 27 2015 14:39:51