It is a motor driver test program Jksoft Blue mbed Board. Jksoft Blue mbed Boardのモータードライバテストプログラムです。

Dependencies:   TB6612FNG2 mbed

main.cpp

Committer:
jksoft
Date:
2014-05-12
Revision:
1:c49f6eb130b4
Parent:
0:effe57895c37

File content as of revision 1:c49f6eb130b4:

#include "mbed.h"
#include "TB6612.h"

TB6612 MOTOR_A(p21,p19,p20);            // PWM IN1 IN2
TB6612 MOTOR_B(p22,p29,p30);            // PWM IN1 IN2
DigitalIn SW1(p25);
DigitalIn SW2(p26);

int main() {
    SW1.mode(PullUp);
    SW2.mode(PullUp);
    while(1)
    {
        if( SW1 == 0 )
        {
            MOTOR_A = 50;
            MOTOR_B = 50;
        }
        else if( SW2 == 0 )
        {
            MOTOR_A = -50;
            MOTOR_B = -50;  
        }
        else
        {
            MOTOR_A = 0;
            MOTOR_B = 0;  
        }
    }
}