Quiz+4-17

Quiz 4-17:

Write a program that would allow the robot to go forward while the light sensor (Light1) is reading less than 34. The reading of the light should be in a function called "AmIOutOfTheCave".

int L;

void AmIOutOfTheCave { L = SensorValue(Light1); }

task main { AmIOutOfTheCave; while(L < 34) { motor[motorB] = 50; motor[motorC] = 50; AmIOutOfTheCave; // this will keep L current } }