Lab 3
Dependencies: Motor Servo mbed
Motor Class Reference
Interface to control a standard DC motor. More...
#include <Motor.h>
Public Member Functions | |
| Motor (PinName pwm, PinName fwd, PinName rev) | |
| Create a motor control interface. | |
| void | speed (float speed) |
| Set the speed of the motor. | |
Detailed Description
Interface to control a standard DC motor.
with an H-bridge using a PwmOut and 2 DigitalOuts
Definition at line 32 of file Motor.h.
Constructor & Destructor Documentation
| Motor | ( | PinName | pwm, |
| PinName | fwd, | ||
| PinName | rev | ||
| ) |
Create a motor control interface.
- Parameters:
-
pwm A PwmOut pin, driving the H-bridge enable line to control the speed fwd A DigitalOut, set high when the motor should go forward rev A DigitalOut, set high when the motor should go backwards
Member Function Documentation
| void speed | ( | float | speed ) |
Set the speed of the motor.
- Parameters:
-
speed The speed of the motor as a normalised value between -1.0 and 1.0
Generated on Thu Jul 14 2022 22:07:32 by
1.7.2