うおーるぼっとLEDのワークショップ用

Dependencies:   mbed

main.cpp

Committer:
jksoft
Date:
2017-02-03
Revision:
0:9fcc79b3f00e
Child:
2:20b6647c8570

File content as of revision 0:9fcc79b3f00e:

#include "mbed.h"
#include "wallbotLED.h"

wallbotLED wb;

int main() {
    while(1) {
        int s1 = wb.GetFloorSensor1();
        int s2 = wb.GetFloorSensor2();
        int s3 = wb.GetFloorSensor3();
        int s4 = wb.GetFloorSensor4();
        
        wb.SetLedPanel(0,9,s1);
        wb.SetLedPanel(0,8,s2);
        wb.SetLedPanel(0,7,s3);
        wb.SetLedPanel(0,6,s4);
        
        if(wb.GetSw1()) {
            wb.driveLeftMotor(1.0);
        }
        else {
            wb.driveLeftMotor(0.0);
        }
        
        if(wb.GetSw2()) {
            wb.driveRightMotor(1.0);
        }
        else {
            wb.driveRightMotor(0.0);
        }
    }
}