Michael Romain
/
coolcarsuperfast
Just trying to update ccode.
Fork of coolcarsuperfast by
Diff: main.cpp
- Revision:
- 9:ad08181ad1cc
- Parent:
- 8:e126c900c89d
- Child:
- 10:e40ad924e935
diff -r e126c900c89d -r ad08181ad1cc main.cpp --- a/main.cpp Fri Apr 03 00:34:57 2015 +0000 +++ b/main.cpp Fri Apr 03 05:06:01 2015 +0000 @@ -71,7 +71,7 @@ int numInterrupts = 0; -float pulsewidth = 0.25f; +float pulsewidth = 0.15f; // Hardware periods float motorPeriod = .0025; @@ -307,15 +307,12 @@ break1 = 0; break2 = 0; - + int loopCounterForModdingSoThatWeCanIncreaseTheRecordingTime = 0; t.start(); printTimer.start(); //wait(5); while(1) { - - if(integrationCounter % 151== 0){ - //break out of main loop if enough time has passed; if(loopCtr >= numData){ break; @@ -386,9 +383,14 @@ } else { approxPos = (float)maxAccum/(float)maxCount; - lineCenters[loopCtr] = approxPos; - times[loopCtr] = printTimer.read_ms(); + if(loopCounterForModdingSoThatWeCanIncreaseTheRecordingTime%3==0){ + lineCenters[loopCtr] = approxPos; + times[loopCtr] = printTimer.read_ms(); + loopCtr++; + } currDir = hardLeft + approxPos/((float) 127)*(hardRight-hardLeft); + + } //Change speed when turning at different angles @@ -432,7 +434,7 @@ //clk = 0; integrationCounter++; - loopCtr++; + loopCounterForModdingSoThatWeCanIncreaseTheRecordingTime++; //camData. } @@ -449,3 +451,4 @@ } pc.printf("]\n\r"); } +