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: TB6612FNG_test line_trace_sample line_trace_sample_saitou line_trace_sample_tamada ... more
TB6612 Class Reference
TB6612FNG Library. More...
#include <TB6612.h>
Public Member Functions | |
| TB6612 (PinName pwm, PinName fwd, PinName rev) | |
| Create a TB6612 connected to the specified pins. | |
| float | speed (float speed) |
| Directly control the speed and direction of the motor. | |
| void | operator= (float value) |
| A operator shorthand for speed() | |
Detailed Description
TB6612FNG Library.
Example:
// Drive the Motor #include "mbed.h" #include "TB6612.h" TB6612 motor(p21,p5,p6); // PWMA,AIN1,AIN2 int main() { motor = 0.0; // Motor stopped. while(1) { motor = 0.5; // Motor forward. wait(2.0); motor = -0.5; // Motor reversal. wait(2.0); } }
Definition at line 58 of file TB6612.h.
Constructor & Destructor Documentation
| TB6612 | ( | PinName | pwm, |
| PinName | fwd, | ||
| PinName | rev | ||
| ) |
Create a TB6612 connected to the specified pins.
- Parameters:
-
pwm A PwmOut pin, driving the H-bridge enable line to control the speed.(PwmOutに対応したポートを指定します。) fwd A DigitalOut, set high when the motor should go forward.(DigitalOutに対応したポートを指定します。) rev A DigitalOut, set high when the motor should go backwards.(DigitalOutに対応したポートを指定します。)
Definition at line 30 of file TB6612.cpp.
Member Function Documentation
| void operator= | ( | float | value ) |
| float speed | ( | float | speed ) |
Directly control the speed and direction of the motor.
- Parameters:
-
speed A normalised number -1.0 - 1.0 represents the full range.
- Returns:
- return the stopped state or direction of rotation.
Definition at line 44 of file TB6612.cpp.
Generated on Sun Jul 17 2022 08:13:23 by
1.7.2