Sagawa Electronics,inc.

Dependencies:   mbed

Fork of sagawa_lpc1114 by kazushiro tanimoto

main.cpp

Committer:
zero515
Date:
2016-11-26
Revision:
0:d90f3421aaef
Child:
1:dbde3f68f80d

File content as of revision 0:d90f3421aaef:

#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");
    }
}