Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
HBridge Class Reference
A simple HBridge controller library. More...
#include <HBridge.h>
Public Member Functions | |
| HBridge (PinName A, PinName B, PinName en) | |
| Creates an instance of the HBridge class. | |
| void | stop () |
| Hard stops the motor. | |
| void | start () |
| Starts the motor. | |
| void | speed (float speed_in) |
| Sets the PWM output of the enable pin and therefore the speed of the motor. | |
| void | power (bool onoff) |
| Turn off and on the enable pin. | |
| void | power (float power_in) |
| Set the pwm value of the enable pin. | |
| void | soft_stop () |
| Soft stop the motor. | |
| void | forward () |
| Go forward, starts the motor. | |
| void | backward () |
| Go backward, starts the motor. | |
| void | forward (float speed_in) |
| Go forward, starts the motor. | |
| void | backward (float speed_in) |
| Go backward, starts the motor. | |
| void | A (bool highlow) |
| Set A high or low. | |
| void | B (bool highlow) |
| Set B high or low. | |
| void | direction (bool direction_in) |
| Set the direction of travel. | |
Detailed Description
A simple HBridge controller library.
Definition at line 39 of file HBridge.h.
Constructor & Destructor Documentation
| HBridge | ( | PinName | A, |
| PinName | B, | ||
| PinName | en | ||
| ) |
Creates an instance of the HBridge class.
- Parameters:
-
A The pin the "A" line is connected to (naming taken from the L293D). B The pin the "B" line is connected to (naming taken from the L293D). en The pin the enable line is connected to.]
Definition at line 3 of file HBridge.cpp.
Member Function Documentation
| void A | ( | bool | highlow ) |
Set A high or low.
- Parameters:
-
highlow Set the high/low state of the A half-bridge (high(true))
Definition at line 103 of file HBridge.cpp.
| void B | ( | bool | highlow ) |
Set B high or low.
- Parameters:
-
highlow Set the high/low state of the B half-bridge (high(true))
Definition at line 108 of file HBridge.cpp.
| void backward | ( | ) |
Go backward, starts the motor.
Definition at line 75 of file HBridge.cpp.
| void backward | ( | float | speed_in ) |
Go backward, starts the motor.
- Parameters:
-
speed_in The float value of the desired speed between 0 and 1
Definition at line 89 of file HBridge.cpp.
| void direction | ( | bool | direction_in ) |
Set the direction of travel.
- Parameters:
-
direction_in Forward = true
Definition at line 95 of file HBridge.cpp.
| void forward | ( | float | speed_in ) |
Go forward, starts the motor.
- Parameters:
-
speed_in The float value of the desired speed between 0 and 1
Definition at line 82 of file HBridge.cpp.
| void forward | ( | ) |
Go forward, starts the motor.
Definition at line 68 of file HBridge.cpp.
| void power | ( | float | power_in ) |
Set the pwm value of the enable pin.
- Parameters:
-
power_in The value of the pwm enable pins
Definition at line 28 of file HBridge.cpp.
| void power | ( | bool | onoff ) |
Turn off and on the enable pin.
- Parameters:
-
onoff Enable the motor or not (on(true))
Definition at line 55 of file HBridge.cpp.
| void soft_stop | ( | ) |
Soft stop the motor.
Definition at line 61 of file HBridge.cpp.
| void speed | ( | float | speed_in ) |
Sets the PWM output of the enable pin and therefore the speed of the motor.
- Parameters:
-
speed_in The float value of the desired speed between -1 and 1
Definition at line 41 of file HBridge.cpp.
| void start | ( | ) |
Starts the motor.
Definition at line 21 of file HBridge.cpp.
| void stop | ( | ) |
Hard stops the motor.
Definition at line 13 of file HBridge.cpp.
Generated on Mon Aug 1 2022 12:00:31 by
1.7.2