#include <c++/Motor.H>
Collaboration diagram for Motor:
Public Types | |
enum | Port { A, B, C } |
valid port designators. More... | |
enum | Limits { min = 0, max = 255 } |
motor speed range. More... | |
Public Methods | |
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... |
This class is designed to manipulate motors attached to an RCX
Definition at line 38 of file Motor.H.
|
motor speed range.
|
|
valid port designators.
Definition at line 43 of file Motor.H. Referenced by Motor(), and MotorPair::MotorPair(). |
|
construct a motor connected to {port}.
Definition at line 61 of file Motor.H. References A, B, md, motor_a_dir(), motor_a_speed(), motor_b_dir(), motor_b_speed(), motor_c_dir(), motor_c_speed(), ms, and Port. |
|
destroy our motor instance.
|
|
set the motor to brake and delay return.
|
|
set the motor to brake.
Definition at line 117 of file Motor.H. Referenced by MotorPair::pivotLeft(), and MotorPair::pivotRight(). |
|
set the motor direction.
Definition at line 87 of file Motor.H. Referenced by MotorPair::brake(), MotorPair::direction(), MotorPair::left(), MotorPair::off(), MotorPair::pivotLeft(), MotorPair::pivotRight(), and MotorPair::right(). |
|
set motor direction to forward at speed {s}.
|
|
set motor direction to forward.
|
|
turn the motor off this disables power and the motor coasts to a stop.
Definition at line 130 of file Motor.H. References md, MotorDirection, ms, and speed(). |
|
set the motor direction to reverse at speed {s}.
|
|
set the motor direction to reverse.
|
|
set the motor speed.
Definition at line 81 of file Motor.H. Referenced by off(), and MotorPair::speed(). |
|
current direction setting for this motor instance.
|
|
current velocity setting for this motor instance.
|
brickOS is released under the
Mozilla Public License.
Original code copyright 1998-2002 by the authors. |