Library for H-Bridge Motor Driver Using Bipolar Transistors
Motor Class Reference
Interface to control a standard DC motor. More...
#include <motorlib.h>
Public Types | |
enum | MCtrlType { L293D_DISCRETE, L293D_PWM, COMPS_DISCRETE, COMPS_PWM } |
Motor Control Type. More... | |
Public Member Functions | |
Motor (PinName r1, PinName r4, MCtrlType mctype=L293D_PWM) | |
Create a motor control interface. | |
void | coast (void) |
Set the motor to coast/roll/off. | |
void | forward (void) |
Rotate motor in clockwise direction. | |
void | backward (void) |
/** Rotate motor in Anti-clockwise direction. | |
void | stop (void) |
Stop the motor. |
Detailed Description
Interface to control a standard DC motor.
Definition at line 18 of file motorlib.h.
Member Enumeration Documentation
enum MCtrlType |
Motor Control Type.
- Enumerator:
Definition at line 21 of file motorlib.h.
Constructor & Destructor Documentation
Create a motor control interface.
- Parameters:
-
r1 DigitalOut, driving H-bridge NPN transistor on the BOTTOm right r2 DigitalOut, driving H-bridge PNP transistor on the TOP right r3 DigitalOut, driving H-bridge NPN transistor on the BOTTOm left. r4 DigitalOut, driving H-bridge PNP transistor on the TOP left mctype DigitalOut, driving H-bridge PNP transistor on the TOP left
Definition at line 27 of file motorlib.cpp.
Member Function Documentation
void backward | ( | void | ) |
/** Rotate motor in Anti-clockwise direction.
- Parameters:
-
void
- Returns:
- void
Definition at line 54 of file motorlib.cpp.
void coast | ( | void | ) |
Set the motor to coast/roll/off.
- Parameters:
-
void
- Returns:
- void
Definition at line 34 of file motorlib.cpp.
void forward | ( | void | ) |
Rotate motor in clockwise direction.
- Parameters:
-
void
- Returns:
- void
Definition at line 41 of file motorlib.cpp.
void stop | ( | void | ) |
Generated on Tue Jul 12 2022 20:46:04 by 1.7.2