to daiki

Dependencies:   Motor mbed

Fork of DualMotor by Kei Ohta

Revision:
1:5f71bf8eaed0
Parent:
0:7bbc230e00d6
Child:
3:5a75e8cb733e
diff -r 7bbc230e00d6 -r 5f71bf8eaed0 main.cpp
--- a/main.cpp	Tue Nov 23 16:19:19 2010 +0000
+++ b/main.cpp	Sun Jul 28 03:18:45 2013 +0000
@@ -1,13 +1,37 @@
-// Sweep the motor speed from full-speed reverse (-1.0) to full speed forwards (1.0)
+/*
+TA7291P
+1 - GND
+2 - OutPut1
+3 - NonConnection
+4 - Vref(PwmOut)
+5 - IN1 (DigitalOut)
+6 - IN2 (DigitalOut)
+7 - VU 5V
+8 - MotorPower(+) 
+9 - NonConnection
+10 - OutPut2
+
+H-Bridge Circuit
+1-0 ClockWise
+0-1 CounterClockWise
+*/
 
 #include "mbed.h"
 #include "Motor.h"
 
-Motor m(p23, p6, p5); // pwm, fwd, rev
+Motor m1(p21, p5, p6); // pwm, fwd, rev
+Motor m2(p23, p7, p8);    // pwm, fwd, rev
+Serial pc(USBTX,USBRX);
 
 int main() {
-    for (float s= -1.0; s < 1.0 ; s += 0.01) {
-       m.speed(s); 
-       wait(0.02);
+    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);
     }
 }