My student is having trouble with the programming to control the flashlight by the light sensor. In the debugger window, we can see the light sensor reading properly, and we can manually control the flashlight. When we try to run the PLTW suggested code, it will not work. Here is the PLTW provided code:
while(1 ==1)
{
if(SensorValue(lightSensor)>700)
{
turnFlashlightOn(flashlight,127);
}
if(SensorValue(lightSensor)<=700)
{
turnFlashlightOff(flashlight);
}
}