TB6612FNG用のモータコントロールライブラリ
Dependents: BLE_WALLBOT_BLE net_trap_noBLE MoveTest Avoid ... 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 01:36:14 by 1.7.2