UH Robotics / PololuQik2

Dependents:   theRobot3

Fork of PololuQik2 by Thomas Ashworth

Embed: (wiki syntax)

« Back to documentation index

PololuQik2 Class Reference

PololuQik2 Class Reference

This is the driver for the motor controller. More...

#include <PololuQik2.h>

Public Member Functions

 PololuQik2 (PinName TxPin, PinName RxPin, PinName RSTPin, PinName errPin, void(*errorFunction)(void), bool enCRC)
 The parameterised constructor for the pololuQik2 motor controller.
void begin ()
 This method initialises and begins communication with the motor controller.
void setMotor0Speed (int8_t speed)
 sets the speed of motor 0.
void setMotor1Speed (int8_t speed)
 sets the speed of motor 1.
void stopBothMotors (int8_t speed)
 instructs the motor controller to halt both motors.
uint8_t getFirmwareVersion ()
 retrieves the firmware version from the motor controller.
bool hasDataOverrunError ()
 Checks if the motor controller has a Data over run error.
bool hasFrameError ()
 Checks if the motor controller has a Frame error.
bool hasCRCError ()
 Checks if the motor controller has a CRC error.
bool hasFormatError ()
 Checks if the motor controller has a Format error.
bool hasTimeoutError ()
 Checks if the motor controller has a time out error.
uint8_t getError ()
 retrieves the error value from the motor controller and stores it in the class internal workings.

Detailed Description

This is the driver for the motor controller.

This is to control a Qik2s9v1. It will not control multiple motor and it does not support daisy chaining motor controllers.

The specification for the motor controller can be found http://www.pololu.com/catalog/product/1110/

This motor controller is based on the work of Mr Fialkowski. This motor controller requires the newSoftSerial library be installed on the build path. This motor controller also requires the CRC7 class.

See also:
CRC7

Definition at line 73 of file PololuQik2.h.


Constructor & Destructor Documentation

PololuQik2 ( PinName  TxPin,
PinName  RxPin,
PinName  RSTPin,
PinName  errPin,
void(*)(void)  errorFunction,
bool  enCRC 
)

The parameterised constructor for the pololuQik2 motor controller.

Attention:
It is important to call the begin() method as this initialises the controller.
See also:
begin()
Parameters:
txPinthe pin on the controller to use for transmitting serial bytes.
rxPinthe pin on the controller to use for recieving serial bytes.
errPinthe digital output pin to use to reset the motor controller.
EnableCRCtrue if CRC should be used when communicating with the motor controller.
resetthe pin on the controller to use to reset the motor controller.

Definition at line 38 of file PololuQik2.cpp.


Member Function Documentation

void begin (  )

This method initialises and begins communication with the motor controller.

This method is also called when an error is exhibited.

See also:
PololuQik2()

Definition at line 56 of file PololuQik2.cpp.

uint8_t getError (  )

retrieves the error value from the motor controller and stores it in the class internal workings.

See also:
errorBitSet()
error()

Definition at line 153 of file PololuQik2.cpp.

uint8_t getFirmwareVersion (  )

retrieves the firmware version from the motor controller.

This will return one of two values. Either the ASCII representation of 1 or the ASCII representation of 2.

The return from this method will be either 49 or 50. If otherwise there is an error.

Returns:
the firmware version of the motor controller.

Definition at line 123 of file PololuQik2.cpp.

bool hasCRCError (  )

Checks if the motor controller has a CRC error.

returns true if it has a CRC error

Definition at line 129 of file PololuQik2.cpp.

bool hasDataOverrunError (  )

Checks if the motor controller has a Data over run error.

returns true if it has a data over run error

Definition at line 141 of file PololuQik2.cpp.

bool hasFormatError (  )

Checks if the motor controller has a Format error.

returns true if it has a Format error

Definition at line 145 of file PololuQik2.cpp.

bool hasFrameError (  )

Checks if the motor controller has a Frame error.

returns true if it has a Frame error

Definition at line 137 of file PololuQik2.cpp.

bool hasTimeoutError (  )

Checks if the motor controller has a time out error.

returns true if it has a time out error

Definition at line 149 of file PololuQik2.cpp.

void setMotor0Speed ( int8_t  speed )

sets the speed of motor 0.

This command has superseded motor0Forwards and motor0Reverse. If the speed is less than 0 then the motor will reverse. If the speed is greater than 0 then the motor will run forward If the speed is 0 then the motor will be stopped.

The bound for the speed are -127 to 127.

Since:
1.2
Parameters:
speedthe speed of the motor. If this value is negative the motor will reverse to the appropriate speed.

Definition at line 68 of file PololuQik2.cpp.

void setMotor1Speed ( int8_t  speed )

sets the speed of motor 1.

This command has superseded motor1Forwards and motor1Reverse. If the speed is less than 0 then the motor will reverse. If the speed is greater than 0 then the motor will run forward If the speed is 0 then the motor will be stopped.

The bound for the speed are -127 to 127.

Since:
1.2
Parameters:
speedthe speed of the motor. If this value is negative the motor will reverse to the appropriate speed.

Definition at line 81 of file PololuQik2.cpp.

void stopBothMotors ( int8_t  speed )

instructs the motor controller to halt both motors.

This is equivalent to called any of the forward or reverse methods with the speed as zero (0).

Definition at line 94 of file PololuQik2.cpp.