for bluetooth
Dependencies: btbee m3pi_ng mbed
Fork of WarehouseBot1 by
Diff: Robot-bae8eb81a9d7/main.cpp
- Revision:
- 3:4284d7cdb68e
- Parent:
- 2:2d147091491d
--- a/Robot-bae8eb81a9d7/main.cpp Thu Jun 04 11:57:24 2015 +0000 +++ b/Robot-bae8eb81a9d7/main.cpp Thu Jun 04 12:18:04 2015 +0000 @@ -39,7 +39,7 @@ int Run = 1; - string blah[36] = {"", "LRRL", "SSRL", "RLSRL", "RLLLRSRLL", "LRLL", + string blah[36] = {"", "LRRL", "SSRL", "RLSRL", "RLLLRSRLLR", "LRLL", "RLLR", "", "SSR", "RLRR", "RLLRLSR", "LRSLR", "RLSS", "LLS", "", "RR", "RLSLR", "LRSSS", "RLSRL", "LLRL", "LL", "", "RLSS", "RLRLS", @@ -55,14 +55,16 @@ time_wait.start(); - turns = blah[(4-1)*6+(2-1)]; + while(Run) { time_wait.reset(); //Get raw sensor values robot.calibrated_sensor(x); + //insert end and beginning locations + turns = blah[(end-1)*6+(start-1)]; //Check to make sure battery isn't low if (robot.battery() < 2.4) { @@ -83,7 +85,7 @@ previous_pos = 0; robot.stop(); //wait(1); - while(/*x[0] > 300 &&*/ x[2] > 300){ + while(x[2] > 300){ turnLeft(); robot.calibrated_sensor(x); } @@ -101,8 +103,12 @@ else if(turns.at(direction) == 'R'){ previous_pos = 0; robot.stop(); + while(x[4] > 300){ + goStraight(); + robot.calibrated_sensor(x); + } //wait(1); - while(x[4] > 300 && x[2] > 300){ + while(x[2] > 300){ turnRight(); robot.calibrated_sensor(x); }