LEGO Engineering

| | | | | | | |
What is the correct procedure to wire a single fork or multiple forks?


22nd of April, 2010

(1 )
100% thumbs up 0% thumbs down

Forks are a sign of choice in a program.  Either the top line of the code is executed, or the bottom, depending on whether a certain condition is met (true) or is not met (false). After the split, the choices need to be merged back together to complete the fork with a 'fork merge'; do not use stop signs to end either side of a fork, as this will result in a program that does not work properly.

The following is incorrect:

fork_errors_pic_1.jpg

Here is the same code with a fork merge added. This compiles and works properly. A jump/land loop is added in to make it a more useful program:

fork_errors_pic_2.jpg


Remember: always use a fork merge with forks.

Wiring multiple forks can be confusing. Just remember that each fork needs its own fork merge.  The error message isn’t always useful in detecting the source of the problem when this occurs.

fork_errors_pic_3.jpg


This is the correct way to use fork merges:


fork_errors_pic_4.jpg






AG
ses
kw
   :
   :
* :
* :
 


Home | About Us | Contact Us

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