Quiz+4-12

Quiz 4-12:

Now that you have yesterday's quiz matered, you can do the following: Give the code that would Read the light sensor into L and read the Sonar sensor into S.

Display the word "Light on the 2nd line of the NXT display Display the value of the light sensor on the 3rd line Display the word Distance on the 5th line of the NXT display Display the value of the sonar sensor on the 6th line

Put all this in a function called ShowSensors.

If you can do the above, you are in great shape for debugging sensors. :)

int L; int S;

void ShowSensors { L = SensorValue(Light); S = SensorValue(Sonar); nxtDisplayCenteredBigTextLine(2,"Light"); nxtDisplayCenteredBigTextLine(3,"%d",L); //Show value of Light Sensor // nxtDisplayCenteredBigTextLine(5,"Distance"); // // nxtDisplayCenteredBigTextLine(6,"%d",S); ////Show value of Sonar Sensor }