task main() { while (true) { if (getIrReading(leftIR) == 0 || getIrReading(rightIR) == 0) { //there is something within the threshold range motor[leftServo] = -15; motor[rightServo] = 15; wait1Msec(400); } else { //nothing in the threshold range motor[leftServo] = 15; motor[rightServo] = 15; } } }
void faceIR(tSensors ir_seeker) { int ir_value = getIrReading(IR); do { if(ir_value < 2) { leftTurn(50); } else if(ir_value > 2) { rightTurn(50); } wait1Msec(1); ir_value = getIrReading(IR); } while(ir_value != 2); }