91 virtual void TurnOn()
override;
103 virtual void TurnOff()
override;
129 virtual std::string
ToString()
const override;
Abstract base class for every component (sensor, actuator, etc.) the library manages.
Definition: BaseComponent.h:60
A DC motor driven through an H-bridge, with an optional enable pin and a wheel alignment used when st...
Definition: Motor.h:27
virtual void TurnOn() override
Turns the motor on by enabling the H-bridge chip (no motion until a Move call).
Definition: Motor.cpp:89
virtual void MoveBackward()
Drives the motor backward, enabling the H-bridge first.
Definition: Motor.cpp:163
unsigned int GetDriveTwoPinNumber() const
Gets the second H-bridge drive pin.
Definition: Motor.cpp:218
Motor(const unsigned int driveOnePinNumber, const unsigned int driveTwoPinNumber, const MotorAlignment alignment=MotorAlignment::None)
Builds a motor driven by two drive pins, assuming the enable pin is always powered.
Definition: Motor.cpp:20
virtual void ProcessRawValues() override
No-op: a motor is an output device with no raw values to process.
Definition: Motor.cpp:129
unsigned int myDriveTwoPinNumber
The second H-bridge drive pin.
Definition: Motor.h:31
virtual void TurnOff() override
Turns the motor off by disabling the enable pin and driving both drive pins low.
Definition: Motor.cpp:108
MotorAlignment myAlignment
This motor's alignment on the vehicle (used when steering).
Definition: Motor.h:32
unsigned int GetDriveOnePinNumber() const
Gets the first H-bridge drive pin.
Definition: Motor.cpp:201
MotorAlignment GetAlignment() const
Gets this motor's alignment on the vehicle.
Definition: Motor.cpp:235
virtual void MoveForward()
Drives the motor forward, enabling the H-bridge first.
Definition: Motor.cpp:144
virtual std::string ToString() const override
Serializes the motor's enable/drive pins and alignment to a string.
Definition: Motor.cpp:252
unsigned int myDriveOnePinNumber
The first H-bridge drive pin.
Definition: Motor.h:30
unsigned int GetEnablePinNumber() const
Gets the H-bridge enable pin (UINT_MAX if the enable pin is always powered).
Definition: Motor.cpp:184
virtual ~Motor() override
Destroys the motor, turning it off first.
Definition: Motor.cpp:74
unsigned int myEnablePinNumber
The H-bridge enable pin (UINT_MAX if the enable pin is always powered).
Definition: Motor.h:29
RumPi is the library's top-level facade.
Definition: AlertManager.h:6
MotorAlignment
Helps determine direction to rotate a motor if/when turning a Vehicle.
Definition: Motor.h:13
@ Left
Definition: Motor.h:14
@ Right
Definition: Motor.h:15
@ Center
Definition: Motor.h:16
@ None
Definition: Motor.h:17