#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} | |
~Motor () | |
destroy our motor instance | |
const void | speed (const unsigned char speed) const |
set the motor speed | |
const void | direction (const MotorDirection dir) const |
set the motor direction | |
const void | forward () const |
set motor direction to forward | |
const void | forward (const unsigned char s) const |
set motor direction to forward at speed {s} | |
const void | reverse () const |
set the motor direction to reverse | |
const void | reverse (const unsigned char s) const |
set the motor direction to reverse at speed {s} | |
const void | brake () const |
set the motor to brake | |
const void | brake (int duration) const |
set the motor to brake and delay return | |
const void | off () const |
turn the motor off this disables power and the motor coasts to a stop |
This class is designed to manipulate motors attached to an RCX
Definition at line 38 of file Motor.H.
enum Motor::Port |
enum Motor::Limits |
Motor::Motor | ( | const Port | port | ) | [inline] |
Motor::~Motor | ( | ) | [inline] |
const void Motor::speed | ( | const unsigned char | speed | ) | const [inline] |
set the motor speed
speed | the desired setting. Must be between min (0) and max (255) |
Definition at line 80 of file Motor.H.
Referenced by forward(), reverse(), and MotorPair::speed().
const void Motor::direction | ( | const MotorDirection | dir | ) | const [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().
const void Motor::forward | ( | ) | const [inline] |
set motor direction to forward
Definition at line 91 of file Motor.H.
References direction(), and fwd.
Referenced by forward().
const void Motor::forward | ( | const unsigned char | s | ) | const [inline] |
const void Motor::reverse | ( | ) | const [inline] |
set the motor direction to reverse
Definition at line 103 of file Motor.H.
References direction(), and rev.
Referenced by reverse().
const void Motor::reverse | ( | const unsigned char | s | ) | const [inline] |
const void Motor::brake | ( | ) | const [inline] |
set the motor to brake
Definition at line 116 of file Motor.H.
References direction().
Referenced by brake(), MotorPair::pivotLeft(), and MotorPair::pivotRight().
const void Motor::brake | ( | int | duration | ) | const [inline] |
const void Motor::off | ( | ) | const [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().
brickOS is released under the
Mozilla Public License.
Original code copyright 1998-2005 by the authors. |