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
|
Motor control interface.
This class is designed to manipulate motors attached to an RCX
- See Also
- The other control classes: MotorPair, Sound, Lamp
- Design Note
- I avoided using derived classes since they were typically three times larger. Also, if one is using Motor(Motor::A), all the decision logic is optimized away in the compiler, so no extra space is used for that.
Definition at line 38 of file Motor.H.