A code with functions for turning right and left.
Dependencies: btbee m3pi_ng mbed
Diff: main.cpp
- Revision:
- 17:4e63e8eacad7
- Parent:
- 16:ee3b36038b6b
- Child:
- 18:acc404d8488c
diff -r ee3b36038b6b -r 4e63e8eacad7 main.cpp --- a/main.cpp Mon Jun 08 11:12:40 2015 +0000 +++ b/main.cpp Mon Jun 08 11:27:29 2015 +0000 @@ -33,6 +33,7 @@ float s1, s2, s3, s4, s5; Timer TurnTime; Timer LapTime; + Timer TotalTime; int counter = 0; string path; char dir; @@ -174,7 +175,6 @@ int stuff; char things[1]; int k = 1; - btbee.printf("Enter a command string: \n"); while(1) { @@ -364,6 +364,8 @@ LapTime.start(); + TotalTime.start(); + path = rga.at(location-1).at(goal-1); while (1) { @@ -464,14 +466,17 @@ goal = command.at(i); - if(goal == 7) { - - command.clear(); - i = 0; - command = GetLocation(); - location = command.at(i); - i++; - goal = command.at(i); + if(goal == 7) { + TotalTime.stop(); + m3pi.printf("%f",TotalTime.read()); + command.clear(); + i = 0; + command = GetLocation(); + m3pi.cls(); + location = command.at(i); + i++; + goal = command.at(i); + }