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.
Dependents: 4180_final_project
Fork of libTCS34725 by
TB6612FNG Class Reference
TB6612FNG control class. More...
#include <TB6612FNG.h>
Public Member Functions | |
| TB6612FNG () | |
| Initialize object with default pins. | |
| TB6612FNG (PinName idir1, PinName idir2, PinName ipwm, PinName istby) | |
| Initialize object with specific motor pins. | |
| void | config (PinName idir1, PinName idir2, PinName ipwm, PinName istby) |
| Change the pins the motor was initialized with. | |
| void | start () |
| Enables the motor. | |
| void | stop () |
| Stops the motor from moving. | |
| void | standby () |
| Disables the motor, puts it into standby. | |
| void | fwd (float speed) |
| Sets the motor to move forward at a given speed (as a percent [0,1]) | |
| void | rev (float speed) |
| Sets the motor to move backward at a given speed (as a percent [0,1]) | |
Detailed Description
TB6612FNG control class.
Example:
//Perform readings on two i2c devices with the same address #include "TB6612FNG.h" #include "mbed.h" int main() { while(1) { } }
Definition at line 24 of file TB6612FNG.h.
Constructor & Destructor Documentation
| TB6612FNG | ( | ) |
Initialize object with default pins.
Definition at line 3 of file TB6612FNG.cpp.
| TB6612FNG | ( | PinName | idir1, |
| PinName | idir2, | ||
| PinName | ipwm, | ||
| PinName | istby | ||
| ) |
Initialize object with specific motor pins.
- Parameters:
-
idir1 Direction pin (IN1) idir2 Second direction pin (IN2) ipwm Motor PWM pin (PWM) istby SCL pin
Definition at line 6 of file TB6612FNG.cpp.
Member Function Documentation
| void config | ( | PinName | idir1, |
| PinName | idir2, | ||
| PinName | ipwm, | ||
| PinName | istby | ||
| ) |
Change the pins the motor was initialized with.
- Parameters:
-
idir1 Direction pin (IN1) idir2 Second direction pin (IN2) ipwm Motor PWM pin (PWM) istby SCL pin
Definition at line 10 of file TB6612FNG.cpp.
| void fwd | ( | float | speed ) |
Sets the motor to move forward at a given speed (as a percent [0,1])
- Parameters:
-
speed Speed of the motor as a percent [0,1]
Definition at line 40 of file TB6612FNG.cpp.
| void rev | ( | float | speed ) |
Sets the motor to move backward at a given speed (as a percent [0,1])
- Parameters:
-
speed Speed of the motor as a percent [0,1]
Definition at line 48 of file TB6612FNG.cpp.
| void standby | ( | ) |
Disables the motor, puts it into standby.
Definition at line 32 of file TB6612FNG.cpp.
| void start | ( | ) |
Enables the motor.
Definition at line 18 of file TB6612FNG.cpp.
| void stop | ( | ) |
Stops the motor from moving.
Definition at line 26 of file TB6612FNG.cpp.
Generated on Sun Jul 17 2022 11:29:04 by
1.7.2
