Junichi Katsu
/
wallbotLED_base
うおーるぼっとLEDのワークショップ用
main.cpp@2:20b6647c8570, 2017-02-03 (annotated)
- Committer:
- jksoft
- Date:
- Fri Feb 03 13:39:44 2017 +0000
- Revision:
- 2:20b6647c8570
- Parent:
- 0:9fcc79b3f00e
???????????????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:9fcc79b3f00e | 1 | #include "mbed.h" |
jksoft | 0:9fcc79b3f00e | 2 | #include "wallbotLED.h" |
jksoft | 0:9fcc79b3f00e | 3 | |
jksoft | 0:9fcc79b3f00e | 4 | wallbotLED wb; |
jksoft | 0:9fcc79b3f00e | 5 | |
jksoft | 0:9fcc79b3f00e | 6 | int main() { |
jksoft | 2:20b6647c8570 | 7 | |
jksoft | 2:20b6647c8570 | 8 | while(wb.GetSw1() == 0); |
jksoft | 2:20b6647c8570 | 9 | |
jksoft | 2:20b6647c8570 | 10 | wait(1.0); |
jksoft | 2:20b6647c8570 | 11 | |
jksoft | 0:9fcc79b3f00e | 12 | while(1) { |
jksoft | 0:9fcc79b3f00e | 13 | int s1 = wb.GetFloorSensor1(); |
jksoft | 0:9fcc79b3f00e | 14 | int s2 = wb.GetFloorSensor2(); |
jksoft | 0:9fcc79b3f00e | 15 | int s3 = wb.GetFloorSensor3(); |
jksoft | 0:9fcc79b3f00e | 16 | int s4 = wb.GetFloorSensor4(); |
jksoft | 0:9fcc79b3f00e | 17 | |
jksoft | 0:9fcc79b3f00e | 18 | wb.SetLedPanel(0,9,s1); |
jksoft | 0:9fcc79b3f00e | 19 | wb.SetLedPanel(0,8,s2); |
jksoft | 0:9fcc79b3f00e | 20 | wb.SetLedPanel(0,7,s3); |
jksoft | 0:9fcc79b3f00e | 21 | wb.SetLedPanel(0,6,s4); |
jksoft | 0:9fcc79b3f00e | 22 | |
jksoft | 0:9fcc79b3f00e | 23 | if(wb.GetSw1()) { |
jksoft | 0:9fcc79b3f00e | 24 | wb.driveLeftMotor(1.0); |
jksoft | 0:9fcc79b3f00e | 25 | } |
jksoft | 0:9fcc79b3f00e | 26 | else { |
jksoft | 0:9fcc79b3f00e | 27 | wb.driveLeftMotor(0.0); |
jksoft | 0:9fcc79b3f00e | 28 | } |
jksoft | 0:9fcc79b3f00e | 29 | |
jksoft | 0:9fcc79b3f00e | 30 | if(wb.GetSw2()) { |
jksoft | 0:9fcc79b3f00e | 31 | wb.driveRightMotor(1.0); |
jksoft | 0:9fcc79b3f00e | 32 | } |
jksoft | 0:9fcc79b3f00e | 33 | else { |
jksoft | 0:9fcc79b3f00e | 34 | wb.driveRightMotor(0.0); |
jksoft | 0:9fcc79b3f00e | 35 | } |
jksoft | 0:9fcc79b3f00e | 36 | } |
jksoft | 0:9fcc79b3f00e | 37 | } |