AF_TB6612FNG is a library of TB6612FNG.

Example

include the mbed library with this snippet

#include "mbed.h"
#include "AF_TB6612FNG.h"

AF_TB6612FNG tb6612fng(p21, p20, p19, p22, p18, p17, p12);

int main() {
    float speed = 0.6;
    tb6612fng.forward(speed);
}

AF_TB6612FNG.h

Committer:
tichise
Date:
2018-06-04
Revision:
2:d6cb78f523b0
Parent:
0:98dcc458e267

File content as of revision 2:d6cb78f523b0:

#ifndef MBED_AF_TB6612FNG_H
#define MBED_AF_TB6612FNG_H

#include "mbed.h"
#include "Moter.h"

class AF_TB6612FNG
{
public:
    AF_TB6612FNG(PinName pwma, PinName ain1, PinName ain2, PinName pwmb, PinName bin1, PinName bin2, PinName standby);
    void stop();
    void forward(float speed);
    void backward(float speed);
    void left(float speed);
    void right(float speed);
    bool isForward();

private:
    Moter _motorL;
    Moter _motorR;
    DigitalOut _standby;

    bool _isForward;
};

#endif