kazushiro tanimoto / Mbed 2 deprecated sagawa_lpc1114

Dependencies:   mbed

Fork of sagawa_lpc1114 by kazushiro tanimoto

Embed: (wiki syntax)

« Back to documentation index

TB6612 Class Reference

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 34 of file TB6612.h.


Constructor & Destructor Documentation

TB6612 ( PinName  pwm,
PinName  fwd,
PinName  rev 
)

Create a TB6612 connected to the specified pins.

Parameters:
pwmA PwmOut pin, driving the H-bridge enable line to control the speed.(PwmOutに対応したポートを指定します。)
fwdA DigitalOut, set high when the motor should go forward.(DigitalOutに対応したポートを指定します。)
revA DigitalOut, set high when the motor should go backwards.(DigitalOutに対応したポートを指定します。)

Definition at line 4 of file TB6612.cpp.


Member Function Documentation

void operator= ( float  value )

A operator shorthand for speed()

Definition at line 52 of file TB6612.h.

float speed ( float  speed )

Directly control the speed and direction of the motor.

Parameters:
speedA normalised number -1.0 - 1.0 represents the full range.
Returns:
return the stopped state or direction of rotation.

Definition at line 18 of file TB6612.cpp.