^
Dependencies: mbed
Fork of Shitty_figure8 by
Revision 2:b1226838afb9, committed 2015-03-20
- Comitter:
- cheryl_he
- Date:
- Fri Mar 20 10:41:03 2015 +0000
- Parent:
- 1:55e0aaf71bda
- Commit message:
- added int track_found to break out of loop if we lose the track
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Mar 20 10:18:20 2015 +0000 +++ b/main.cpp Fri Mar 20 10:41:03 2015 +0000 @@ -24,6 +24,7 @@ float approxPos; float minVal; int minLoc; +int track_found = 1; // 1 if found //Servo turning parameters float straight = 0.00155f; @@ -123,10 +124,13 @@ for(int i=0; i<numDownslopes; i++){ for(int j=0; j<numUpslopes; j++){ if(upslope_locs[j] - downslope_locs[i] >=4 && upslope_locs[j] - downslope_locs[i] <=5){ - track_location = downslope_locs[i] + 2 ; + track_location = downslope_locs[i] + 2; } } } + if (numUpslopes == 0 && numDownslopes == 0){ + track_found = 0; + } return track_location; } @@ -236,8 +240,7 @@ //wait(5); - while(1) { - + while(1 && track_found) { if(integrationCounter % 151== 0){ //Disable interrupts //__disable_irq(); @@ -337,7 +340,7 @@ ADCdata[integrationCounter - 1] = 1 - camData; clk = 0; } - + //clk = 0; integrationCounter++; //camData.