Wyatt
1.0.1
|
#include <MotorAdapter.h>
Public Member Functions | |
MotorAdapter (AdafruitPWMServoHat *m_pwmHat, int forwardPin, int backwardPin) | |
~MotorAdapter () override | |
void | write (IMessage *msg) override |
std::list< IMessage * > * | read () override |
Public Member Functions inherited from IHardwareInterface | |
virtual | ~IHardwareInterface () |
Hardware adapter for communicating with the Pololu motors TODO: Change the MotorMessage type to send data in terms of velocity (cm/s) instead of motor power([-4095, 4095]). This will uncouple the rest of the program from the hardware specifics.
Definition at line 18 of file MotorAdapter.h.
MotorAdapter::MotorAdapter | ( | AdafruitPWMServoHat * | m_pwmHat, |
int | forwardPin, | ||
int | backwardPin | ||
) |
Constructor
m_pwmHat | PAdafruitPWMServoObject used to communicate with motor |
forwardPin | Set this pin to PWM to drive motor forward. Set to 0 for backwards. |
backwardPin | Set this pin to PWM to drive motor backward. Set to 0 for forward. |
Definition at line 7 of file MotorAdapter.cpp.
|
override |
Deconstructor.
Definition at line 13 of file MotorAdapter.cpp.
|
inlineoverridevirtual |
Read data from the motor. Cannot. Returns empty list.
Implements IHardwareInterface.
Definition at line 45 of file MotorAdapter.h.
|
overridevirtual |
Write a message to the motor. Contains an integer representing the speed of the motor [-4095 - 4095] = [Full Backwards, Full Forwards]
msg | A message wrapping a byte specifying motor speed |
MismatchedMessageException | Message is of wrong type |
Implements IHardwareInterface.
Definition at line 17 of file MotorAdapter.cpp.