Henrique Cardoso / Mbed OS Lidar_Rodas

Dependencies:   BufferedSerial

Embed: (wiki syntax)

« Back to documentation index

Robot.h File Reference

Robot.h File Reference

Go to the source code of this file.

Functions

void setSpeeds (int16_t leftSpeed, int16_t rightSpeed)
 Sets the speed for both motors.
void setLeftSpeed (int16_t speed)
 Sets the speed for the left motor.
void setRightSpeed (int16_t speed)
 Sets the speed for the right motor.
void getCounts ()
void getCountsAndReset ()

Detailed Description

Definition in file Robot.h.


Function Documentation

void getCounts (  )

Returns the number of counts that have been detected from the both encoders. These counts start at 0. Positive counts correspond to forward movement of the wheel of the Romi, while negative counts correspond to backwards movement.

The count is returned as a signed 16-bit integer. When the count goes over 32767, it will overflow down to -32768. When the count goes below -32768, it will overflow up to 32767.

Definition at line 41 of file Robot.cpp.

void getCountsAndReset (  )

This function is just like getCounts() except it also clears the counts before returning. If you call this frequently enough, you will not have to worry about the count overflowing.

Definition at line 53 of file Robot.cpp.

void setLeftSpeed ( int16_t  speed )

Sets the speed for the left motor.

Parameters:
speedA number from -300 to 300 representing the speed and direction of the left motor. Values of -300 or less result in full speed reverse, and values of 300 or more result in full speed forward.

Definition at line 21 of file Robot.cpp.

void setRightSpeed ( int16_t  speed )

Sets the speed for the right motor.

Parameters:
speedA number from -300 to 300 representing the speed and direction of the right motor. Values of -300 or less result in full speed reverse, and values of 300 or more result in full speed forward.

Definition at line 31 of file Robot.cpp.

void setSpeeds ( int16_t  leftSpeed,
int16_t  rightSpeed 
)

Sets the speed for both motors.

Parameters:
leftSpeedA number from -300 to 300 representing the speed and direction of the left motor. Values of -300 or less result in full speed reverse, and values of 300 or more result in full speed forward.
rightSpeedA number from -300 to 300 representing the speed and direction of the right motor. Values of -300 or less result in full speed reverse, and values of 300 or more result in full speed forward.

Definition at line 10 of file Robot.cpp.