LEGO Engineering

| | | | | | | |
What is an event?


22nd of April, 2010

(3 )
100% thumbs up 0% thumbs down

An event is something that the program monitors for, no matter what else is going on.  For this reason it is very useful to use events to get out of infinite loops created by jumps.  The example below is a simple example of when to use events.  The car goes in a square until its light sensor reads 40.  Notice that not only is it necessary to set up the light event but it is also necessary to start monitoring for the event and place the land event in the correct location.

events_general_pic_1.jpg


If you wanted the program to end after 45 seconds even if the program had not reached that light value you can add a timer event: notice that there is only one landing. It is only possible to have one event land. 

events_general_pic_2.jpg


It is not necessary to start and stop the events in the same place for example:

events_general_pic_3.jpg


or as another example:

events_general_pic_4.jpg


Since there is only ONE land, this brings up the issue of how to do two different things based on which event is triggered.  The best way is to use an event fork, please see the question titled: "How can I tell which event has been triggered?" for more information.




AG
ses

   :
   :
* :
* :
 


Home | About Us | Contact Us

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