Library | Building | Programming | Quick Guides Home | Quick Guides to Building | Quick Guides to Programming | LVLM | WeDo
ROBOLAB

DocumentsDate added

Order by : Name | Date | Hits | [ Descendent ]
file icon Wait for Pushhot!Tooltip 05/26/2006 Hits: 4891
file icon NXT - Multiple Eventshot!Tooltip 06/11/2006 Hits: 6949

 

Just like single events, multiple events can be setup in the same code to track different variables. The only difference is that all event structures must have the same event landing. This means that if 3 events are setup and only one triggers, the code will have to determine which one of the 3 changed so it can perform the appropriate action. In this example, two push events are used to control the motion of a car. After setting up both events, monitoring is started and the code is forced into an infinite loop. This is done to prevent the code from reaching the event landing block prematurely. If the red event (touch sensor 1) is triggered, the code will take the upper path in the event fork and stop motor A. If the red event was not triggered, then by default, the blue event must have been triggered and the code will take the bottom the path of the fork. Three or more events can be checked by increasing the number of event forks.

«StartPrev1234NextEnd»
Page 4 of 4
Home | About Us | Contact Us
© 2013 Center for Engineering Educational Outreach, Tufts University
© 2013 The LEGO Group. All rights reserved.