Michael Romain
/
Shitty_figure8
Framework for doing the figure 8 track.
Diff: main.cpp
- Revision:
- 3:e867c4e984df
- Parent:
- 2:a04e2757d372
--- a/main.cpp Fri Mar 20 10:33:58 2015 +0000 +++ b/main.cpp Fri Mar 20 10:49:25 2015 +0000 @@ -280,14 +280,14 @@ minVal = ADCdata[15]; for (int c = 10; c < 118; c++) { - if (ADCdata[c] < minVal){ + if (ADCdata[c] > minVal){ minVal = ADCdata[c]; minLoc = c; } } for (int c = 10; c < 118; c++) { - if (ADCdata[c] >= minVal && ADCdata[c] - minVal < 0.08f && ADCdata[c] > 0.1f){ + if (ADCdata[c] <= minVal && minVal - ADCdata[c] < 0.07f && ADCdata[c] > 0.1f){ minAccum += c; minCount++; } @@ -308,8 +308,8 @@ motor2.pulsewidth(.0025*.105); } else if (approxPos > 40 && approxPos <= 90){ servo.pulsewidth(straight); - motor1.pulsewidth(.0025*.1125); - motor2.pulsewidth(.0025*.1125); + motor1.pulsewidth(.0025*.11); + motor2.pulsewidth(.0025*.11); } else if (approxPos > 90 && approxPos <= 105){ servo.pulsewidth(slightRight); motor1.pulsewidth(.0025*.105); @@ -334,7 +334,7 @@ else{ clk = 1; wait_us(220); - ADCdata[integrationCounter - 1] = 1 - camData; + ADCdata[integrationCounter - 1] = camData; clk = 0; }