Library for driving the IBT-2 H-bridge motor controller (with BTS 7960 or BTN 7971 half bridges).
IBT2 Class Reference
Interface to the IBT-2 H-bridge motor controller. More...
#include <IBT2.h>
Public Member Functions | |
| IBT2 (PinName L_pwm, PinName R_pwm, PinName en, float freq) | |
| Create an IBT-2 control interface. | |
| void | setSpeed (float speed) |
| Set the speed and direction of the motor. | |
| float | getSpeed (void) |
| Get the speed and direction of the motor. | |
Detailed Description
Interface to the IBT-2 H-bridge motor controller.
Control a DC motor connected to the IBT-2 H-bridge using one of two modes:
Mode 1: 2 PwmOuts and 1 DigitalOut
- L_PWM controlled with a PwmOut
- R_PWM controlled with a PwmOut
- L_EN, R_EN connected to a DigitalOut (High is Enabled)
Mode 2: 1 PwmOut and 2 DigitalOuts
- L_PWM connected to a DigitalOut (High is Forward; keep R_PWM Low)
- R_PWM connected to a DigitalOut (High is Reverse; keep L_PWM Low)
- L_EN, R_EN controlled with a PwmOut
For now, only Mode 1 is used.
Definition at line 46 of file IBT2.h.
Constructor & Destructor Documentation
| IBT2 | ( | PinName | L_pwm, |
| PinName | R_pwm, | ||
| PinName | en, | ||
| float | freq | ||
| ) |
Create an IBT-2 control interface.
- Parameters:
-
L_pwm A PwmOut pin, driving the L_PWM H-bridge line to control the forward speed. R_pwm A PwmOut pin, driving the R_PWM H-bridge line to control the reverse speed. en A DigitalOut pin, driving the L_EN and R_EN H-bridge enable lines. freq The frequency of the H-bridge PWM lines in Hz.
Member Function Documentation
| float getSpeed | ( | void | ) |
Generated on Fri Jul 29 2022 08:25:18 by
1.7.2