to daiki

Dependencies:   Motor mbed

Fork of Motor_HelloWorld by Simon Ford

main.cpp

Committer:
ohtake_i
Date:
2013-12-22
Revision:
3:5a75e8cb733e
Parent:
1:5f71bf8eaed0

File content as of revision 3:5a75e8cb733e:

/*
TA7291P
1 - GND
2 - OutPut1
3 - NonConnection
4 - Vref(PwmOut)
5 - IN1 (DigitalOut)
6 - IN2 (DigitalOut)
7 - VU 5V from mbed
8 - MotorPower(+) 
9 - NonConnection
10 - OutPut2

H-Bridge Circuit
1-0 ClockWise
0-1 CounterClockWise
*/

#include "mbed.h"
#include "Motor.h"

Motor m1(p21, p5, p6); // pwm, fwd, rev
Motor m2(p23, p7, p8);    // pwm, fwd, rev
Serial pc(USBTX,USBRX);

int main() {
    while(1) {
//        pc.printf("motorOFF\r\n");
        m1.speed(0.0f);
        m2.speed(-1.0f);
        wait(5.0);
//        pc.printf("motorON\r\n");
        m1.speed(1.0f);
        m2.speed(0.0f);
        wait(1.0);
    }
}