PIDs and fun
Dependencies: btbee m3pi_ng mbed FatFileSystemCpp
Diff: main.cpp
- Revision:
- 2:1e947dcc40cb
- Parent:
- 1:936e329e840a
- Child:
- 3:ebe015c72bba
--- a/main.cpp Fri May 22 14:06:50 2015 +0000 +++ b/main.cpp Wed May 27 11:38:48 2015 +0000 @@ -21,7 +21,6 @@ int main() { - double IR; while(1) { @@ -75,11 +74,6 @@ btbee.printf("Finished calibrating \n"); - while (m3pi_IN [0] == 0) { - btbee.printf("Obstacle detected. Please remove to continue"); - m3pi.stop(); - wait(3.0); - } float right; float left; @@ -101,8 +95,15 @@ while (1) { - - // Get the position of the line. + if(m3pi_IN [0] == 0) { + while (m3pi_IN [0] == 0) { + btbee.printf("Obstacle detected. Please remove to continue"); + m3pi.stop(); + wait(3.0); + } +} + + // Get the position of the line. current_pos_of_line = m3pi.line_position(); proportional = current_pos_of_line; @@ -217,3 +218,5 @@ } } + +