Sagawa Electronics,inc.

Dependencies:   mbed

Fork of sagawa_lpc1114 by kazushiro tanimoto

Committer:
zero515
Date:
Sat Nov 26 18:33:38 2016 +0000
Revision:
0:d90f3421aaef
Child:
1:dbde3f68f80d
sagawa mbed4adrobo sample program

Who changed what in which revision?

UserRevisionLine numberNew contents of line
zero515 0:d90f3421aaef 1 #include "mbed.h"
zero515 0:d90f3421aaef 2 #include "TB6612.h"
zero515 0:d90f3421aaef 3 #include "SoftPWM.h"
zero515 0:d90f3421aaef 4
zero515 0:d90f3421aaef 5 DigitalOut led1(P2_11);
zero515 0:d90f3421aaef 6 DigitalOut led2(P0_2);
zero515 0:d90f3421aaef 7 DigitalOut led3(P0_7);
zero515 0:d90f3421aaef 8 DigitalOut led4(P0_3);
zero515 0:d90f3421aaef 9
zero515 0:d90f3421aaef 10 AnalogIn ad0(P0_11);
zero515 0:d90f3421aaef 11 AnalogIn ad1(P1_0);
zero515 0:d90f3421aaef 12 AnalogIn ad2(P1_1);
zero515 0:d90f3421aaef 13 AnalogIn ad3(P1_2);
zero515 0:d90f3421aaef 14 AnalogIn ad5(P1_4);
zero515 0:d90f3421aaef 15 AnalogIn ad7(P1_11);
zero515 0:d90f3421aaef 16
zero515 0:d90f3421aaef 17 TB6612 motor1a(P2_7,P2_9,P2_8);
zero515 0:d90f3421aaef 18 TB6612 motor1b(P2_4,P2_6,P2_5);
zero515 0:d90f3421aaef 19
zero515 0:d90f3421aaef 20 Serial pc(P1_7, P1_6);
zero515 0:d90f3421aaef 21
zero515 0:d90f3421aaef 22
zero515 0:d90f3421aaef 23 int main() {
zero515 0:d90f3421aaef 24 pc.baud(19200);
zero515 0:d90f3421aaef 25
zero515 0:d90f3421aaef 26 led1 = 0;
zero515 0:d90f3421aaef 27 led2 = 0;
zero515 0:d90f3421aaef 28 led3 = 0;
zero515 0:d90f3421aaef 29 led4 = 0;
zero515 0:d90f3421aaef 30 motor1a = 0.0;
zero515 0:d90f3421aaef 31 motor1b = 0.0;
zero515 0:d90f3421aaef 32
zero515 0:d90f3421aaef 33 while(1) {
zero515 0:d90f3421aaef 34
zero515 0:d90f3421aaef 35 led1 = 1;
zero515 0:d90f3421aaef 36 motor1a = 0.2; // Motor forward.
zero515 0:d90f3421aaef 37 wait(1.0);
zero515 0:d90f3421aaef 38 led1 = 0;
zero515 0:d90f3421aaef 39
zero515 0:d90f3421aaef 40 led2 = 1;
zero515 0:d90f3421aaef 41 motor1a = -0.2; // Motor reversal.
zero515 0:d90f3421aaef 42 wait(1.0);
zero515 0:d90f3421aaef 43 led2 = 0;
zero515 0:d90f3421aaef 44
zero515 0:d90f3421aaef 45 motor1a = 0.0;
zero515 0:d90f3421aaef 46
zero515 0:d90f3421aaef 47 led3 = 1;
zero515 0:d90f3421aaef 48 motor1b = 0.2; // Motor forward.
zero515 0:d90f3421aaef 49 wait(1.0);
zero515 0:d90f3421aaef 50 led3 = 0;
zero515 0:d90f3421aaef 51
zero515 0:d90f3421aaef 52 led4 = 1;
zero515 0:d90f3421aaef 53 motor1b = -0.2; // Motor reversal.
zero515 0:d90f3421aaef 54 wait(1.0);
zero515 0:d90f3421aaef 55 led4 = 0;
zero515 0:d90f3421aaef 56
zero515 0:d90f3421aaef 57 motor1b = 0.0;
zero515 0:d90f3421aaef 58
zero515 0:d90f3421aaef 59 pc.printf("check_ok \r\n");
zero515 0:d90f3421aaef 60 }
zero515 0:d90f3421aaef 61 }