to daiki

Dependencies:   Motor mbed

Fork of DualMotor by Kei Ohta

Committer:
ohtake_i
Date:
Sun Dec 22 01:00:56 2013 +0000
Revision:
3:5a75e8cb733e
Parent:
1:5f71bf8eaed0
for Ayami

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ohtake_i 1:5f71bf8eaed0 1 /*
ohtake_i 1:5f71bf8eaed0 2 TA7291P
ohtake_i 1:5f71bf8eaed0 3 1 - GND
ohtake_i 1:5f71bf8eaed0 4 2 - OutPut1
ohtake_i 1:5f71bf8eaed0 5 3 - NonConnection
ohtake_i 1:5f71bf8eaed0 6 4 - Vref(PwmOut)
ohtake_i 1:5f71bf8eaed0 7 5 - IN1 (DigitalOut)
ohtake_i 1:5f71bf8eaed0 8 6 - IN2 (DigitalOut)
ohtake_i 3:5a75e8cb733e 9 7 - VU 5V from mbed
ohtake_i 1:5f71bf8eaed0 10 8 - MotorPower(+)
ohtake_i 1:5f71bf8eaed0 11 9 - NonConnection
ohtake_i 1:5f71bf8eaed0 12 10 - OutPut2
ohtake_i 1:5f71bf8eaed0 13
ohtake_i 1:5f71bf8eaed0 14 H-Bridge Circuit
ohtake_i 1:5f71bf8eaed0 15 1-0 ClockWise
ohtake_i 1:5f71bf8eaed0 16 0-1 CounterClockWise
ohtake_i 1:5f71bf8eaed0 17 */
simon 0:7bbc230e00d6 18
simon 0:7bbc230e00d6 19 #include "mbed.h"
simon 0:7bbc230e00d6 20 #include "Motor.h"
simon 0:7bbc230e00d6 21
ohtake_i 1:5f71bf8eaed0 22 Motor m1(p21, p5, p6); // pwm, fwd, rev
ohtake_i 1:5f71bf8eaed0 23 Motor m2(p23, p7, p8); // pwm, fwd, rev
ohtake_i 1:5f71bf8eaed0 24 Serial pc(USBTX,USBRX);
simon 0:7bbc230e00d6 25
simon 0:7bbc230e00d6 26 int main() {
ohtake_i 1:5f71bf8eaed0 27 while(1) {
ohtake_i 1:5f71bf8eaed0 28 // pc.printf("motorOFF\r\n");
ohtake_i 1:5f71bf8eaed0 29 m1.speed(0.0f);
ohtake_i 1:5f71bf8eaed0 30 m2.speed(-1.0f);
ohtake_i 1:5f71bf8eaed0 31 wait(5.0);
ohtake_i 1:5f71bf8eaed0 32 // pc.printf("motorON\r\n");
ohtake_i 1:5f71bf8eaed0 33 m1.speed(1.0f);
ohtake_i 1:5f71bf8eaed0 34 m2.speed(0.0f);
ohtake_i 1:5f71bf8eaed0 35 wait(1.0);
simon 0:7bbc230e00d6 36 }
simon 0:7bbc230e00d6 37 }