A single port of the TB6612 motor controller.
More...
#include <TB6612.h>
A single port of the TB6612 motor controller.
◆ Direction
Motor turning direction.
| Enumerator |
|---|
| Clockwise | |
| CounterClockwise | |
◆ Type
Basic Thing types.
| Enumerator |
|---|
| Undetermined | |
| Switch | |
| DistanceSensor | |
| ControlledMotor | |
| UncontrolledMotor | |
◆ TB6612Motor() [1/3]
| TB6612Motor::TB6612Motor |
( |
| ) |
|
◆ TB6612Motor() [2/3]
| TB6612Motor::TB6612Motor |
( |
byte |
pinIn1, |
|
|
byte |
pinIn2 |
|
) |
| |
Create a motor driver without speed control.
- Parameters
-
| pinIn1 | See note below |
| pinIn2 | See note below |
- Note
- pinIn1 = H, pinIn2 = L give clockwise rotation
-
pinIn1 = L, pinIn2 = H gives counter clock wise rotation
-
all other combinations will result in a short brake
- Warning
- - Note that without PWM, the speed of the motor cannot be controlled.
-
- Make sure the standby pin is pulled high.
◆ TB6612Motor() [3/3]
| TB6612Motor::TB6612Motor |
( |
byte |
pinIn1, |
|
|
byte |
pinIn2, |
|
|
byte |
pinPWM |
|
) |
| |
Create a motor driver with speed control.
- Parameters
-
| pinIn1 | See note below |
| pinIn2 | See note below |
| pinPWM | the speed of the rotation, 0 = short break, 255 = max speed |
- Note
- pinIn1 = H, pinIn2 = L give clockwise rotation
-
pinIn1 = L, pinIn2 = H gives counter clock wise rotation
-
all other combinations will result in a short brake
- Warning
- - Make sure the standby pin is pulled high.
◆ SetSpeed()
| void TB6612Motor::SetSpeed |
( |
float |
speed | ) |
|
|
virtual |
◆ GetSpeed()
| float Motor::GetSpeed |
( |
| ) |
|
|
virtualinherited |
Get the current target speed of the motor.
- Returns
- The speed between -1 (full backward), 0 (stop) and 1 (full forward)
◆ IsMotor()
◆ IsSensor()
◆ pinIn1
| byte Passer::RoboidControl::TB6612Motor::pinIn1 |
The pin number for the in1 signal.
◆ pinIn2
| byte Passer::RoboidControl::TB6612Motor::pinIn2 |
The pin number for the in2 signal.
◆ pinPWM
| byte Passer::RoboidControl::TB6612Motor::pinPWM |
The pin for the PWM speed signal.
◆ direction
The forward turning direction of the motor.
◆ currentTargetSpeed
| float Passer::RoboidControl::Motor::currentTargetSpeed = 0 |
|
protectedinherited |
◆ type
| unsigned int Passer::RoboidControl::Thing::type |
|
inherited |
◆ SwitchType
◆ DistanceSensorType
| const unsigned int Thing::DistanceSensorType |
|
staticinherited |
Initial value:=
static const unsigned int SensorType
Bitmap for Sensor type.
Definition Thing.h:31
◆ ControlledMotorType
| const unsigned int Thing::ControlledMotorType |
|
staticinherited |
Initial value:=
static const unsigned int MotorType
Bitmask for Motor type.
Definition Thing.h:29
◆ UncontrolledMotorType
| const unsigned int Thing::UncontrolledMotorType |
|
staticinherited |
◆ MotorType
| const unsigned int Passer::RoboidControl::Thing::MotorType = 0x8000 |
|
staticprotectedinherited |
◆ SensorType
| const unsigned int Passer::RoboidControl::Thing::SensorType = 0x4000 |
|
staticprotectedinherited |
The documentation for this class was generated from the following files:
- d:/PlatformIO/RoboidControlArduino/src/TB6612.h
- d:/PlatformIO/RoboidControlArduino/src/TB6612.cpp