Just like touch sensors, the light sensor can be used with the waituntil command.
The difference is that you must compare the sensor value to a threshold to determine when the waituntil is complete.
|
Run Button ^ |
|
|
Click on the Click for Sensor A box,
and select a Light Sensor.
Type the procedure on the right into the Procedure window and type test into the Run This line, or . Then click Download and the Cricket's Run Button. |
to test send sensora a, on waituntil [sensora > 150] a, off send sensora end |
Now you can drag the slider on the light sensor, to simulate the sensor getting darker.
If you drag it up high enough, the sensor value will climb above 150. Then, the waituntil will exit, the motor will be turned off, and the new value of the light sensor will show up in the Monitor Box.
What happens when you run the procedure again (click on the Crickets Run Button) if you dont adjust the light sensor after it finished the last time?