Line Health / TB6612FNG

Dependents:   4180_final_project

Fork of libTCS34725 by Michael Wilkens

Embed: (wiki syntax)

« Back to documentation index

TB6612FNG Class Reference

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:
idir1Direction pin (IN1)
idir2Second direction pin (IN2)
ipwmMotor PWM pin (PWM)
istbySCL 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:
idir1Direction pin (IN1)
idir2Second direction pin (IN2)
ipwmMotor PWM pin (PWM)
istbySCL 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:
speedSpeed 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:
speedSpeed 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.