void refresh_buffer(){ int i; for(i=0; i<READINGS_BUFFER_SIZE;i++){ waitTick40ms(); refresh_sensorReadings(STATE_DEFAULT); } }
int main(void){ initPIC32(); closedLoopControl( false ); setVel2(0, 0); //Stop Engines while(1){ printf("Press start to continue\n"); while(!startButton()); do{ waitTick40ms(); int ground = readLineSensors(0); if(NEAR_LEFT_BLACK(ground)) setVel2(0, 50); else if(NEAR_RIGHT_BLACK(ground)) setVel2(50, 0); else if(FAR_LEFT_BLACK(ground)) setVel2(-50, 50); else if (FAR_RIGHT_BLACK(ground)) setVel2(50, -50); else if(GROUND_CENTER_BLACK(ground)) setVel2(55, 60); else setVel2(50, -50); }while(!stopButton()); } return 0; }