Junichi Katsu
/
wallbotLED_base
うおーるぼっとLEDのワークショップ用
Diff: main.cpp
- Revision:
- 0:9fcc79b3f00e
- Child:
- 2:20b6647c8570
diff -r 000000000000 -r 9fcc79b3f00e main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Feb 03 06:26:54 2017 +0000 @@ -0,0 +1,32 @@ +#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); + } + } +}