Motor control interface. More...
#include <c++/Motor.H>
Public Types | |
enum | Port { A, B, C } |
valid port designators More... | |
enum | Limits { min = 0, max = 255 } |
motor speed range More... | |
Public Member Functions | |
Motor (const Port port) | |
construct a motor connected to {port} More... | |
~Motor () | |
destroy our motor instance More... | |
const void | speed (const unsigned char speed) const |
set the motor speed More... | |
const void | direction (const MotorDirection dir) const |
set the motor direction More... | |
const void | forward () const |
set motor direction to forward More... | |
const void | forward (const unsigned char s) const |
set motor direction to forward at speed {s} More... | |
const void | reverse () const |
set the motor direction to reverse More... | |
const void | reverse (const unsigned char s) const |
set the motor direction to reverse at speed {s} More... | |
const void | brake () const |
set the motor to brake More... | |
const void | brake (int duration) const |
set the motor to brake and delay return More... | |
const void | off () const |
turn the motor off this disables power and the motor coasts to a stop More... | |
Private Attributes | |
void(* | ms )(unsigned char speed) |
current velocity setting for this motor instance More... | |
void(* | md )(const MotorDirection dir) |
current direction setting for this motor instance More... | |
Motor control interface.
This class is designed to manipulate motors attached to an RCX
enum Motor::Limits |
enum Motor::Port |
|
inline |
|
inline |
|
inline |
set the motor to brake
Definition at line 116 of file Motor.H.
References direction().
Referenced by MotorPair::pivotLeft(), and MotorPair::pivotRight().
|
inline |
|
inline |
set the motor direction
dir | must be one of the MotorDirection values |
Definition at line 86 of file Motor.H.
Referenced by MotorPair::brake(), brake(), MotorPair::direction(), forward(), MotorPair::left(), MotorPair::off(), off(), MotorPair::pivotLeft(), MotorPair::pivotRight(), reverse(), and MotorPair::right().
|
inline |
set motor direction to forward
Definition at line 91 of file Motor.H.
References direction(), and fwd.
|
inline |
|
inline |
turn the motor off this disables power and the motor coasts to a stop
Definition at line 129 of file Motor.H.
References direction().
Referenced by ~Motor().
|
inline |
set the motor direction to reverse
Definition at line 103 of file Motor.H.
References direction(), and rev.
|
inline |
|
inline |
|
private |
|
private |
brickOS is released under the
Mozilla Public License.
Original code copyright 1998-2005 by the authors. |