Sagawa Electronics,inc.

Dependencies:   mbed

Fork of sagawa_lpc1114 by kazushiro tanimoto

Revision:
0:d90f3421aaef
Child:
1:dbde3f68f80d
diff -r 000000000000 -r d90f3421aaef main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Nov 26 18:33:38 2016 +0000
@@ -0,0 +1,61 @@
+#include "mbed.h"
+#include "TB6612.h"
+#include "SoftPWM.h"
+
+DigitalOut led1(P2_11);
+DigitalOut led2(P0_2);
+DigitalOut led3(P0_7);
+DigitalOut led4(P0_3);
+
+AnalogIn ad0(P0_11);
+AnalogIn ad1(P1_0);
+AnalogIn ad2(P1_1);
+AnalogIn ad3(P1_2);
+AnalogIn ad5(P1_4);
+AnalogIn ad7(P1_11);
+
+TB6612 motor1a(P2_7,P2_9,P2_8);
+TB6612 motor1b(P2_4,P2_6,P2_5);
+
+Serial pc(P1_7, P1_6);
+
+
+int main() {
+    pc.baud(19200);
+    
+    led1 = 0;
+    led2 = 0;
+    led3 = 0;
+    led4 = 0;
+    motor1a = 0.0;
+    motor1b = 0.0;
+    
+    while(1) {
+        
+        led1 = 1;
+        motor1a = 0.2;    // Motor forward.
+        wait(1.0);
+        led1 = 0;
+        
+        led2 = 1;
+        motor1a = -0.2;   // Motor reversal.
+        wait(1.0);
+        led2 = 0;
+
+        motor1a = 0.0;
+        
+        led3 = 1;
+        motor1b = 0.2;    // Motor forward.
+        wait(1.0);
+        led3 = 0;
+        
+        led4 = 1;
+        motor1b = -0.2;   // Motor reversal.
+        wait(1.0);
+        led4 = 0;
+        
+        motor1b = 0.0;
+        
+        pc.printf("check_ok \r\n");
+    }
+}