Simple Interface for Toshiba's TB6612FNG H-Bridge Motor Driver
TB6612FNG Class Reference
Simple Interface for Toshiba's TB6612FNG H-Bridge Motor Driver. More...
#include <TB6612FNG.h>
Public Member Functions | |
TB6612FNG (PinName pwm, PinName ctrl1, PinName ctrl2, int pwmPeriod=100, bool brakeOnZeroDC=true) | |
Create TB6612FNG object connected to the specified mbed pins. | |
void | setPulseWidth (int pw) |
Sets the PWM pulse width. | |
void | on () |
activates the motor at the duty cycle selected with setPulseWidth() | |
void | off () |
deactivates the motor (sets the motor output to high impedance, no short brake) | |
void | brake () |
brakes the motor by shorting it | |
void | setZeroDCReaction (bool brakeOnZeroDC) |
set behaviour for zero DC setting | |
void | operator= (int pw) |
pulse width assignment |
Detailed Description
Simple Interface for Toshiba's TB6612FNG H-Bridge Motor Driver.
Definition at line 7 of file TB6612FNG.h.
Constructor & Destructor Documentation
TB6612FNG | ( | PinName | pwm, |
PinName | ctrl1, | ||
PinName | ctrl2, | ||
int | pwmPeriod = 100 , |
||
bool | brakeOnZeroDC = true |
||
) |
Create TB6612FNG object connected to the specified mbed pins.
- Parameters:
-
pwm PwmOut pin name ctrl1/ctrl2 DigitalOut control pin name pwmPeriod sets the PWM period (µs) brakeOnZeroDC true: The motor brakes on zero pulse width setting. false: The motor output is set to high impedance
Definition at line 3 of file TB6612FNG.cpp.
Member Function Documentation
void brake | ( | ) |
brakes the motor by shorting it
Definition at line 54 of file TB6612FNG.cpp.
void off | ( | ) |
deactivates the motor (sets the motor output to high impedance, no short brake)
Definition at line 47 of file TB6612FNG.cpp.
void on | ( | ) |
activates the motor at the duty cycle selected with setPulseWidth()
Definition at line 27 of file TB6612FNG.cpp.
void operator= | ( | int | pw ) |
pulse width assignment
- Parameters:
-
pw is the PWM pulse width setting in µs
- See also:
- setPulseWidth(int pw)
Definition at line 50 of file TB6612FNG.h.
void setPulseWidth | ( | int | pw ) |
Sets the PWM pulse width.
- Parameters:
-
pw is the PWM pulse width setting in µs. The sign of the given pulsewidth defines the direction. With the default PWM period of 100µs (f=10kHz) this value is equivalent to the duty cycle.
Definition at line 18 of file TB6612FNG.cpp.
void setZeroDCReaction | ( | bool | brakeOnZeroDC ) |
set behaviour for zero DC setting
- Parameters:
-
brakeOnZeroDC true: The motor brakes on zero pulse width setting. false: The motor output is set to high impedance
Definition at line 61 of file TB6612FNG.cpp.
Generated on Wed Jul 13 2022 12:40:45 by 1.7.2