LEGO Engineering

| | | | | | | |
What is the difference between the wait for light and wait for brighter commands?


23rd of April, 2010

(5 )
100% thumbs up 0% thumbs down

The major difference between the wait for light and the 'wait for brighter' is that 'wait for brighter' is a relative command and 'wait for light' is an absolute command. 'Wait for brighter' waits until the value of the light sensor changes by a specified amount (the default is 5), and 'wait for light' waits until an absolute, specified value is reached (the default is 55). If you are trying to detect a change in the light value, then 'wait for brighter' or 'wait for darker' is the appropriate function to use. However, if you want to wait until a specific value of light is reached, use 'wait for dark' or 'wait for light'.

Here is a simple comparison between the 'wait for light' and 'wait for brighter' icons:

-'Wait for light':

light_vs_brighter_pic_1.jpg

-'Wait for brighter'

light_vs_brighter_pic_2.jpg

Note: make sure the values are reasonable for your RCX. In the 'wait for brighter' program above, for example, the program won’t trigger until the light value increases by 70. Unless the initial value of light is 30 or lower, the light level will not be able to increase by 70. Perform a test run and change constants as needed to fit the environment.

In general, use 'wait for darker' when you are trying to have an RCX look for a dark line. While it is difficult to predict the exact value of the light sensor at the line, it is easy to note that the light value will change when the light sensor passes over the dark line. Of course, testing the value of the light sensor and using this value with the 'w ait for dark' command would achieve the same goal.

Below are examples of programs performing these functions in different ways:

light_vs_brighter_pic_3.jpg


The following is the equivalent of using the wait for brighter command with a value of ten, but it is much more difficult to interpret and is more cluttered:

light_vs_brighter_pic_4.jpg





AG
ses

   :
   :
* :
* :
 


Home | About Us | Contact Us

© 2013 Center for Engineering Educational Outreach, Tufts University
© 2013 The LEGO Group. All rights reserved.