Junichi Katsu
/
wallbotLED_base
うおーるぼっとLEDのワークショップ用
main.cpp@0:9fcc79b3f00e, 2017-02-03 (annotated)
- Committer:
- jksoft
- Date:
- Fri Feb 03 06:26:54 2017 +0000
- Revision:
- 0:9fcc79b3f00e
- Child:
- 2:20b6647c8570
??
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 | 0:9fcc79b3f00e | 7 | while(1) { |
jksoft | 0:9fcc79b3f00e | 8 | int s1 = wb.GetFloorSensor1(); |
jksoft | 0:9fcc79b3f00e | 9 | int s2 = wb.GetFloorSensor2(); |
jksoft | 0:9fcc79b3f00e | 10 | int s3 = wb.GetFloorSensor3(); |
jksoft | 0:9fcc79b3f00e | 11 | int s4 = wb.GetFloorSensor4(); |
jksoft | 0:9fcc79b3f00e | 12 | |
jksoft | 0:9fcc79b3f00e | 13 | wb.SetLedPanel(0,9,s1); |
jksoft | 0:9fcc79b3f00e | 14 | wb.SetLedPanel(0,8,s2); |
jksoft | 0:9fcc79b3f00e | 15 | wb.SetLedPanel(0,7,s3); |
jksoft | 0:9fcc79b3f00e | 16 | wb.SetLedPanel(0,6,s4); |
jksoft | 0:9fcc79b3f00e | 17 | |
jksoft | 0:9fcc79b3f00e | 18 | if(wb.GetSw1()) { |
jksoft | 0:9fcc79b3f00e | 19 | wb.driveLeftMotor(1.0); |
jksoft | 0:9fcc79b3f00e | 20 | } |
jksoft | 0:9fcc79b3f00e | 21 | else { |
jksoft | 0:9fcc79b3f00e | 22 | wb.driveLeftMotor(0.0); |
jksoft | 0:9fcc79b3f00e | 23 | } |
jksoft | 0:9fcc79b3f00e | 24 | |
jksoft | 0:9fcc79b3f00e | 25 | if(wb.GetSw2()) { |
jksoft | 0:9fcc79b3f00e | 26 | wb.driveRightMotor(1.0); |
jksoft | 0:9fcc79b3f00e | 27 | } |
jksoft | 0:9fcc79b3f00e | 28 | else { |
jksoft | 0:9fcc79b3f00e | 29 | wb.driveRightMotor(0.0); |
jksoft | 0:9fcc79b3f00e | 30 | } |
jksoft | 0:9fcc79b3f00e | 31 | } |
jksoft | 0:9fcc79b3f00e | 32 | } |