Upload
s8739her
View
219
Download
0
Embed Size (px)
Citation preview
8/3/2019 Rl-ReferenceGuide
1/406
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, and
ROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.All other rights reserved.
Visit www.lego.com/education & www.legoengineering.com
RRROOOBBBOOOLLLAAABBBRRReeefffeeerrreeennnccceee
GGGuuuiiidddeeeVVVeeerrrsssiiiooonnn 111...444
8/3/2019 Rl-ReferenceGuide
2/406
2
Preface: Getting Help with ROBOLABROBOLAB is a growing application for which users canreceive support in many different ways. Embedded inROBOLAB are context help and extended help information andexamples. A PDF is available on the ROBOLAB CD that focuseson teaching readers how to use different components of thesoftware.
Several books have been written that focus on tips andtricks for using ROBOLAB and LEGO bricks and accompanyingactivities for use with students. These books includePhysics by Design by Barbara Bratzel(http://www.collegehousebooks.com/physics_by_design.htm)and Engineering with LEGO Bricks and ROBOLAB by Eric L.
Wang (http://www.collegehousebooks.com/lego_bricks.htm).
Carnegie Mellons Robotic Institute has developedadditional support. Their NXT Mobile Robotics Curriculumand NXT Engineering Projects Curriculum is available atfrom your LEGO Education distributor.
The web also serves as a means of finding information, newcapabilities, suggested ways to use the software, classroomcurriculum, and additional tutorials on using ROBOLAB. Theweb component is a continually growing environment where we
update and add new material and sample curriculum all thetime.
This guide is designed to serve as an extended referenceresource for the ROBOLAB software. It aims to supplementthe other support and help components that already exist.With nearly 300 pages of information, the ROBOLAB ReferenceGuide is best used as an interactive electronic documentfrom which pages or sections can be printed if needed. TheGuide is a dynamic project, continually growing and beingupdated. The most current version is available for downloadat www.legoengineering.com.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
http://www.collegehousebooks.com/physics_by_design.htmhttp://www.collegehousebooks.com/lego_bricks.htmhttp://www.collegehousebooks.com/lego_bricks.htmhttp://www.collegehousebooks.com/physics_by_design.htm8/3/2019 Rl-ReferenceGuide
3/406
3
Help in ROBOLABThe first place to look for help is within ROBOLAB. Allversions of ROBOLAB have context help for the softwareenvironment. Help can be turned on and off using the HelpButton or via keyboard shortcuts (CTRL-H)
Context HelpBox
Help Button
After turning on the help, placing your mouse over anyobject in a window or icon the context help will present adescription of the item or directions on how to use it.This type of help can be useful for learning how to use theAdministrator, Pilot, or Investigator sections of ROBOLAB.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
4/406
4
The Clihere formore hellink
When programming in Inventor or higher levels ofInvestigator, context help is also available for each ofthe icons. This help that comes up describes thefunctionality of the command, default settings, and theelements of it that can be modified. In ROBOLAB 2.5 andhigher, the Click here for more help link appears in theContext Help window. This brings up extended helpinformation and a sample program that uses the command(that can be opened and downloaded). The extended help
allows the user to see examples.
The Using ROBOLAB guideFor a more detailed introduction to using the software,step by step directions, and more examples and challenges,the Using ROBOLAB guideis very useful. This PDF isavailable through your LEGO Education distributor or inelectronic (pdf) format at www.legoengineering.com.
Topics in the Users Manual Include
The Pilot and Inventor levels of programming in thePROGRAMMER component of ROBOLAB. This is all one needsto program a LEGO robot.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
5/406
5
The INVESTIGATOR component that is used for data logging.This section adds scientific investigation to therobots capabilities, allowing the RCX to become asmart and mobile data logging tool. The Investigator
component also includes a Journal Area for documentinga project in text and photographs or illustrations anda Publish feature for sharing results.
The enhanced Media features: the Piano Player and Cameraavailable in ROBOLAB 2.5.1 and higher. The manual alsoshows how to use some of the higher level capabilitiesincluding Vision Center and subroutines.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
6/406
6
ROBOLAB Web SitesROBOLAB has a growing web based community that hasinformation, ideas, and examples of users in action. Two
web sites that have learning resources, developerinformation and SDKs, new downloads, more documentation andsupport are:
http://www.legoengineering.com
and
http://www.lego.com/education
These sites are a great place to visit for up to the minutepatches, new features, additions, and tutorials. Both sitesalso maintain a large number of links to curriculumresources, activity databases, and information on classroommaterials. The Lego Users Group Network (LUGNET) atwww.lugnet.com (not officially supported by LEGO) alsoprovides a great resource for discussing ROBOLAB and otherLEGO issues and locating additional information.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
http://www.legoengineering.com/http://www.lego.com/educationhttp://www.lugnet.com/http://www.lugnet.com/http://www.lego.com/educationhttp://www.legoengineering.com/8/3/2019 Rl-ReferenceGuide
7/406
7
TABLE OF CONTENTSPreface: Getting Help with ROBOLAB ........................ 2Help in ROBOLAB ......................................... 3ROBOLAB Web Sites ....................................... 6
TABLE OF CONTENTS ......................................... 71. About ROBOLAB .......................................... 91. About ROBOLAB .......................................... 9Low Entry --High Ceiling ................................ 9ROBOLAB and LabVIEW .................................... 10
2. Programming Icons and Examples ........................ 15Basic Outputs .......................................... 16Behaviors .............................................. 28Wait Fors .............................................. 39Tasks & Subroutines (Structures) ....................... 67
Forks .................................................. 71Jumps ................................................. 102Loops ................................................. 105Events ................................................ 133Task Priority ......................................... 171Music ................................................. 172Investigator .......................................... 176Reset ................................................. 198Containers ............................................ 212RCX Communications .................................... 255Modifiers ............................................. 264
Direct Functions ...................................... 295Internet .............................................. 300Advanced .............................................. 302Control Lab Interface ................................. 305NXT Commands .......................................... 310G-Code ................................................ 326Multimedia ............................................ 345
3. How To .............................................. 3583.1 Using Vision Sensors Outside of Vision Center ..... 3593.2 Containers in ROBOLAB ............................. 3633.3 User Data in ROBOLAB .............................. 364
4. Customizing ROBOLAB .................................. 3664.1 Editing the Default.prf file ...................... 3674.2 Creating your own Sensor Definition Files ......... 3724.3 Customizing Investigator .......................... 378
5. Help & Idea Sources .................................. 384Appendix ................................................ 387
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
8/406
8
Troubleshooting Programming Problems .................. 388Tips and Tricks ....................................... 394Related Web Sites and Resources ....................... 397
Acknowledgements ........................................ 398Index ................................................... 399
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
9/406
9
1. About ROBOLABROBOLAB is the software that provides the tools andenvironment for programming, creating, learning andexploring with the LEGO RCX and NXT. With an intuitive,graphical interface, students of all ages are able tocreate autonomous robotic creations, collect data, composemusic, and snap pictures.
The RCX & NXT The Programmable LEGO Bricks
Low Entry --High CeilingLEGO elements can be a powerful teaching tool for studentsof all ages. Using LEGO bricks a kindergarten student canexplore the concept of numbers and sorting. Add a fewmotors and sensors to those LEGO bricks and a collegestudent can learn about engineering and physics by buildinga robot or a set-up to measure spring constants. Having
students from 5 - 25 use the same toolset to learn allowsmore time to be focused on learning and exploring and lesson learning how to use software.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
10/406
10
ROBOLAB and LabVIEWROBOLAB is built on top of a robust piece of software
called LabVIEW. LabVIEW is a powerful programmingenvironment used by engineers and scientists in collegesand industry. It is the leading software development toolfor measurement and control. Created by NationalInstruments (Texas, US) in 1997, LabVIEW is used to analyzeand compute real results for biomedical, aerospace, energyresearch applications and numerous other applications.NASA, for example, monitored the Mars Sojourner Rover'slocation and position in relation to the landing craft, itsorientation to the ground, its overall physical health andmore using LabVIEW.
LabVIEW is a graphical programming development environmentthat allows scientists and engineers to write programs andcreate user interfaces. A basic LabVIEW program, called avirtual instrument (vi) has 2 components to it a frontpanel and a diagram. The front panel is where standarduser interface options like buttons, dials, and graphs aredisplayed.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
11/406
11
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, and
Run Button
A Simple LabVIEW Front Panel
The simple LabVIEW front panel for the vi,addtwonumbers.vi, above allows the user to enter twonumbers (Number 1 and Number 2) when the program isexecuted by pressing the run button. What happens when therun button is pressed is defined in the diagram. Thediagram defines the logic and operations of the vi (LabVIEWprogram).
ROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.All other rights reserved.
Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
12/406
12
A Simple LabVIEW Diagram
The diagram above takes Number 1 and Number 2 and adds themtogether and displays the result in Answer.Addtwonumbers.vi is an overly simple example of LabVIEWs
capabilities but helps to demonstrate the graphicalinterface and basic concepts.
ROBOLAB makes use of LabVIEWs capabilities and interfacein several ways. LabVIEWs intuitive graphical interfacemakes it easy for the developers of ROBOLAB to programquickly and easily. All the customized screens andtemplates, including the Administrator, the Pilot Levels,Investigator, Vision Center, and Piano Player are LabVIEWfront panels. Behind those front panels are diagrams thatcontain the complicated programming that provides their
functionality.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
13/406
13
The Pilot 1 Front Panel
The Pilot 1 Diagram
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
14/406
14
At the Inventor Level and the higher programming levels ofInvestigator, users are actually doing modified LabVIEWprogramming. The bottom purple window that appears isactually a LabVIEW diagram.
FrontPanel
Diagram
When the run button is pressed, the code is compiled andsent to the RCX or NXT. A window will pop-up asking if youare using the RCX, the NXT, or theControl Lab? The
majority of ROBOLAB programming doesnt require the frontpanel so it is presented in a smaller format and used todisplay additional directions and information (like theWelcome to Inventor message).
The similarities between the upper levels of ROBOLAB andLabVIEW mean that ROBOLAB users have much of the power ofLabVIEW at their disposal allowing them to perform nearlyany task or challenge they can conceive. It also meansthat users who wish to go further with programming have asolid foundation in this type of graphical programming
environment and can easily transition to using LabVIEW.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
15/406
15
2. Programming Icons and ExamplesThis chapter provides additional hints and example programsfor all of the ROBOLAB icons (excluding a few higher levelpalettes). The examples can also be accessed through theextended help in ROBOLAB 2.5 and higher (using the Clickhere for more help link in the Help Window). The sectionswere created using the highest, most comprehensive level ofROBOLAB (Investigator Program Level 5). Hence, if youare using lower levels of Inventor or Investigator some ofthe icons listed may not appear on your Functions Palette.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
16/406
16
Basic Outputs
BeginAlways start an Inventor program with thiscommand.
Example
This piece of code would turn on motor A for one second and
then turn it off.
EndAlways end an Inventor program with this command.Each task will need its own end command.
Example
This piece of code would turn on motor A for one second andthen turn it off.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
17/406
17
Motor AForward
Motor AReverse
Motor BForward
Motor BReverse
Motor CForward
Motor CReverse
Use this if you have a motor connected to port A, B,or C that will be spinning in the forward or reversedirection. Use the power level modifier to change howfast the motor spins, from 1 (slow) to 5 (fast).Without a modifier, the power level will be 5 (fast).
Example
This piece of code would turn on motor A in the forwarddirection for one second and then turn it off.
Lamp A Lamp B Lamp C
Use this if you want the lamps connected to port A, B,or C to turn on. Use the power level modifier tochange it from bright (5) to dim (1). Without amodifier, the power level will be 5 (bright).
Example
This piece of code would turn on the lamp connected to portA for one second and then turn it off.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
18/406
18
Stop A Stop B Stop C Stop allOutputs
Use this to stop the motor or lamp connected to portsA, B, and C by braking (abrupt stop). To get a moregradual stop, use the float command.
Example
This piece of code would turn on the lamp connected to port
A for one second and then turn it off.
PlaySoundUse this command to get an audio response fromthe RCX. Change sounds using the sound typemodifier. This modifier must be an integer from 1to 6. Each represents a pre-programmed sound. 1:Key-click, 2: Beep Beep, 3: Descending Sweep, 4:Rising Sweep, 5: Buzz, 6: Fast Rising Sweep.
Example
This piece of code would play a fast rising sweep sound(the default).
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
19/406
19
FlipDirectionUse this command to flip the directions of themotors once they are on. Use the ports modifierto flip specific ports. Without a modifier,
this command will flip the direction of allports. This does NOT turn the motor on. Itneeds to be used in combination with a commandthat starts the motor or at a point in yourprogram where the motor is already on.
Example
This piece of code would turn on motor A in the forwarddirection, wait one second, flip the direction of motor A(to reverse), wait one second, and then turn motor A off.
FloatOutputsUse this command if you want motors to come to amore gradual stop. This command will simply stoppowering the motors. Use the ports modifier tofloat specific ports. Without a modifier, thiscommand will float all ports.
Example
This piece of code would turn on motor A in the forwarddirection for one second then it would float the motor.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
20/406
20
LampUse this command to turn on lamps. The portsmodifier allows you to choose which lamps youwant to turn on. If no modifier is used, this
command will turn on all ports. Use the powerlevel command to change from 5 (bright) to 1(dim). Without a modifier, the power level willbe 5.
Example
This piece of code would turn on lamps connected to ports Aand C at power level 3. After 6 seconds, it would turn themoff.
StopOutputsUse this to stop motors or turn off lamps. Thiscommand abruptly stops motors by braking. To geta more gradual stop, use the float command. Usemodifiers to choose which ports to stop. Withouta modifier, this command stops all ports.
Example
This piece of code would turn on motors A and B in theforward direction for two seconds and then stop bothmotors.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
21/406
21
MotorForward MotorReverseUse this to turn on the motor(s) in the forwarddirection. Use the ports modifier to choose whichmotors to turn on. Without a modifier, this commandwill turn on all ports. Use the power level modifierto change how fast the motor spins, from 1 (slow) to 5(fast). Without a modifier, the power level will be 5(fast).
Example
This piece of code would turn on motors connected to portsA and B in the forward direction. After 4 seconds, it would
turn them off.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
22/406
22
MotorRandomUse this icon when you want the motor to turn onin a random direction. This icon DOES turn themotor on. The default is to turn on all ports to
power level 5.
Example
ion.
m
This piece of code turns motor A on in a random direct
otor runs for 10 seconds, and then stops.The
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, and
motChangMotorSpeed
Use this icon when you want to change or assignor speeds. This does NOT turn the motor on. It
needs to be used in combination with a commandthat starts the motor or at a point in yourprogram where the motor is already on.
eExample
This piece of code turns on motor A in the forwarddirection at full power for one second, then it changes topower level 3 for ten seconds and turns off.
ROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.All other rights reserved.
Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
23/406
23
Reverse ForwardThis command just sets the direction of the motor toforward or reverse. It does NOT turn the motor on. Itneeds to be used in combination with a command thatstarts the motor or at a point in your program wherethe motor is already on. If the motor is already goingin the reverse or forward direction, there will be nochange.
Example
This piece of code assigns the speed of motor B to 3, andthe direction of motor B to reverse, and then turns it on.After 2 seconds it turns the motor off.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
24/406
24
RandomDirection
Use this icon when you want the direction ofthe motor to be randomly selected. This doesNOT turn the motor on. It needs to be used incombination with a command that starts the
motor or at a point in your program where themotor is already on.
Example
This piece of code turns motor A on in the forwarddirection and then randomly selects a direction for themotor (forward or backward), the motor runs for 10 secondsand is then stopped.
Use this command to turn on motors and lamps withtheir last power and direction settings.TurnOutputs
ample
On
Ex
This piece of code assigns the speed of motor B to 3, andthe direction of motor B to forward, and then turns it on.After 2 seconds it turns motor B off.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
25/406
25
Use this command when you want the speed anddirection of the motor related to positive andnegative numbers.
MotorForwardor BackEx ample
This piece of code puts the value -5 in the red container.It then loops 11 times running the motor at the speed inthe red container for 1 second , beeping and thenaugmenting the value of the container by 1. Hence, themotor runs backwards from speeds 5 - 1, stops while thepower is equal to 0, and the runs forward from speeds 1-5.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
26/406
26
MotorPower
This command will turn on motors at specifiedpower level. Indicate the motors by using theport A, B, or C icons. To specify a power level,string in a numeric constant. 1to 100 are
forward, 0 is stopped (no power), and -1 to -100are backward.
Example
Motors A and C will turn on in the forward direction atspeed 50. After 4 seconds, the motors will be turned off.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
27/406
27
MotorForwardOrBackString
This command will turn on motors at a power levelspecified by a string. Indicate the motors byusing the port A, B, or C icons (or encoder A, B,or C in the NXT commands menu). To specify a
power level, right-click (control-click for Macusers) on the lower right corner and chooseCreate Constant. This will allow you to type inthe name of a string variable to use to controlmotor speed.
Example
In this example, an NXT motor is trying to remain in thesame position. The value of the encoder on NXT motor A isplaced in a string container called rotation. The valuespeed is calculated using the Evaluate Expression command.Then, the variable speed is used as the power level forMotor A. This process repeats indefinitely as it is insidejump commands. Depending on the desired sensitivity anddirection the motor is connected, the values in the speed
expression may need to be modified.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
28/406
28
Behaviors
GoStraight
This behavior is Go Straight. This behavior is
written for a two motor car. In any behavior,you can modify the code to fit your needs.
Example
This code turns motors A and C on in the forward directionond, then turns off the motors.for 1 sec
This behavior is Turn. This behavior is written
Example
for a two motor car. In any behavior, you canmodify the code to fit your needs.Turn
is code turns motor A on forward and motor C on backward.ThAfter 0.25 seconds, the motors are turned off.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
29/406
29
LurchThis behavior is Lurch. It makes the car goforward then stop then go forward again anumber of times. This behavior is written for atwo motor car. In any behavior, you can modifythe code to fit your needs.
Example
one second, then off for one second. This loop repeats 10times.
In this code, motors A and C are set to go in the forwarddirection. Then a loop begins that turns the motors on for
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
30/406
30
SnakeThis behavior is Snake. It makes the car turnfrom side to side a number of times. Thisbehavior is written for a two motor car. In anybehavior, you can modify the code to fit your
needs.
Example
This code first sets the motors for a power level of 5 (thedefault). Then it sets motor A's direction to backward andmotor C's direction to forward. It then enters a loop whichturns the motors on for one second, then reverses theirdirections. This loop repeats 10 times.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
31/406
31
Drive ToBump
This behavior is Drive to Bump. It makes thecar drive forward until a touch sensor ispushed. This behavior is written for a two
motor car. In any behavior, you can modify thecode to fit your needs.
Example
This code turns on motors A and C in the forward direction.When touch sensor 1 is pushed, motors A and C turn off.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
32/406
32
Drive ToDark
This behavior is Drive to Dark. It makes the cardrive forward until the light sensor readingdrops. This behavior is written for a two motorcar. In any behavior, you can modify the code to
fit your needs.
Example
This code turns on motors A and C in the forward direction.When the light sensor reading falls by five (the default),motors A and C turn off.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
33/406
33
TwoButtonRemote
This behavior is Two Button Remote. It allows youto control the direction your car drives with twotouch sensors. This behavior is written for a twomotor car. In any behavior, you can modify the
code to fit your needs.
Example
This code is written for the motors to be connected toports A and C and touch sensors to be connected to ports 1
task split is used so that each motor iscontrolled by one touch sensor in a separate task. Eachtask consists of a forever loop and a touch sensor fork.When a touch sensor is pressed, that motor turns on in the
forward direction. So, when both touch sensors are pressed,both motors go forward, causing the car to drive straight.When neither touch sensor is pressed, both motors arestopped, causing the car to stay still. If only touchsensor 1 is pressed, then only motor A is on, causing thecar to turn.
and 2. A
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, and
ROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.All other rights reserved.
Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
34/406
34
StayStill
This behavior is Stay Still. It makes the carstay in the same place. If you push it, it willreturn to the original spot. This behavior iswritten for a one motor car with an angle sensor
attached to a second set of wheels. In anybehavior, you can modify the code to fit yourneeds.
Example
This program begins by resetting the angle sensor (whichsets the original spot the car will try to return to). Thena forever loop begins. In this loop, The value of therotation sensor is multiplied by 5, and this value is usedfor motor speed. In this way, the car will return to theoriginal spot (0 r
otations, moving at speed 0, or stopped)if it is pushed. If you find that your car runs away fromyou - reverse the direction of the motor of change thecontainer multiplier to a negative number. You can adjustthe sensitivity of the proportional control by adjusting
the multiplier.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
35/406
35
Drive AndSing
This behavior is Drive and Sing. It makes the cardrive forward while playing a song. This behavioris written for a two motor car. In any behavior,you can modify the code to fit your needs.
Example
This program uses a task split so that the car can driveand play a song at the same time. The top task turns onmotors A and C in the forward direction. After 5 seconds,it turns the motors off. The bottom task plays the redscroll. After the red scroll finishes, all outputs (thedefault) are turned off.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
36/406
36
SingUntilDark
This behavior is Sing until Dark. It causes theRCX to repeat a song until the light sensorreading drops below a specified value. The codeuses an event to monitor for the drop in light
sensor reading. Therefore, the reading must beginor rise above the cutoff before an event can betriggered by the drop in light sensor reading. Inany behavior, you can modify the code to fit yourneeds.
Example
This program uses an event to trigger the end of the song.A light sensor event is set up as the red event and islooking for the light sensor reading to fall below 55.Next, the program begins monitoring for the red event. Thered scroll is played in a forever loop. When the lightsensor reading falls below 55, the event will be triggered,ending the program and the song.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
37/406
37
SampleLight
This behavior is Sample Light. Use this tobehavior to collect light sensor data. In anybehavior, you can modify the code to fit yourneeds.
Example
This program initializes light sensor data logging, thenlogs data every 0.1 seconds. This continues until 50 datapoints have been collected, then data logging stops.
mpleAnd Dt light sensor data while
driving. This behavior is written for a two motor. In any behavior, you can modify the code to
fit your needs.
ample
This behavior is Sample and Drive. Use this tobehavior to collec
Sa rive car
Ex
This program turns on motors A and C in the forwarddirection. It then initializes light sensor data logging,and logs data every 0.1 seconds. This continues until 50data points have been collected, then data logging stops.Finally, the outputs are turned off.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
38/406
38
PositionControl
This behavior is Position Control. It allows formuch greater precision in car movement. Theconstant and distance can be varied. Thisbehavior is written for a one motor car. In any
behavior, you can modify the code to fit yourneeds.
Example
This program begins by optimizing RCX behavior andresetting the angle sensor. The proportionality constant,Kp, is set up as 10.5. Then a loop begins in which thevalue of the angle sensor is placed in the red container,and motor A is turned on by a power level that is computedby subtracting the red contained from 32 and multiplying bythe proportionality constant, Kp. After a 0.05 delay, theloop is repeated. The loop repeats 400 times and then motorA is turned off.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
39/406
39
Wait Fors
Wait for1 second Wait for2secondsWait for4seconds
Wait for6secondsWait for8seconds
Wait for10secondsUse these icons if you want to wait for the specifiedamount of time before moving on to the next command.Useful to choose duration of motor and lamp activity.
Example
This piece of code would turn on motor A in the reversedirection for 2 seconds, and then turn it off.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, and
Wait forTimeto choose duration of motor and
lamp activity.
ample
Use this icon if you want to specify the numberof seconds to wait before moving on to the nextcommand. Useful
Ex
itThis piece of code would turn on motor A for the number ofseconoff.
ds specified on the control panel and then turn
ROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.All other rights reserved.
Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
40/406
40
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, and
Wait forRandomTime
this if you want to wait a random amount oftime before moving on to the next command. Usemodifier to change the max random time from 5
seconds. Useful to choose duration of motor and
e
Use
lamp activity.
Exampl
of code would turn on motor A for a randomieceamount of time between 0 and 5 seconds and then turn itThis p
off.
Wait fornthousandthsof asecon
Use this if you want to wait a certain numberof thousandths of seconds before moving on tothe next command. Useful to choose durationof motor and lamp activity.
dExample
ece of code would turn on Motor A and C for a thef thousandths of seconds specified on the control
sor was pressed, in which case both motors wouldrn off.
This pinumber opanel, then run Motor A forward and B backward until a
touch sentu
ROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.All other rights reserved.
Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
41/406
41
it for Nhundredthsof a second
dths of seconds before moving on tothe next command. Useful to choose durationof motor and lamp activity.
Example
Use this if you want to wait a certain numberof hundre
Wa
This piece of code would turn on motor A for the number ofhundredths of seconds specified on the control panel and
then turn it off.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
42/406
42
Wait forTime(min)
Use this if you want to wait a certain number ofminutes before moving on to the next command.Useful to choose duration of motor and lampactivity.
Example
This piece of code would turn on motor A for the number of
minutes specified on the control panel and then turn itff.o
Wait for 100Points Wait for 500PointsWaitintfor 10so
ul in Investigator. Use these icons when youollect the specified number of data points
Most usefant to cw
before moving on to the next command.
Example
This piece of code clears the data memory, then logs 500points of rotation sensor data.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
43/406
43
Wait forN Points
Most useful in Investigator. Use this icon whenyou want to collect a certain number of datapoints before moving on to the next command.
Example
mailb
This piece of code would take 50 data points from theox.
WaitPush
Use this icon to wait for something to push inthe touch sensor before moving on to the next
mand.
ample
for com
Ex
If an IP number was strung onto the Begin icon, this pieceof code would be sent over the Internet. It would turn onmotor A until a touch sensor was pressed and then shut itoff.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
44/406
44
Wait forLet Go
Use this icon to wait for something to releasethe touch sensor before moving on to the nextcommand. If the touch sensor is not pressed tobegin with, the touch sensor must be pressed then
released.
Example
If an IP number was strung onto the Begin direct icon, thispiece of code would control an RCX in direct mode over theInternet. It would turn on motor A on the remote RCX untila touch sensor was released and then turn it off.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, and
Wait forghtain value before moving
on to the next command.
ample
Use this icon to wait for the light reading tobecome greater than a cert
LiEx
This piece of code turns on motor A, then waits for thelight sensor to read a value greater than 55 (the default).Then, it turns off the motor.
ROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.All other rights reserved.
Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
45/406
45
Wait forDark
Use this icon to wait for the light reading tobecome less than a certain value before moving onto the next command.
Example
This piece of code turns on motor A, then waits for thelight sensor to read a value less than 55 (the default).Then, it turns off the motor.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, and
Wait forBrighertain value before moving to the
next command.
ample
Use this icon to wait for the light reading toincrease by a c
terEx
This piece of code turns on motor A, then waits for thelight reading to increase by 5 (the default). Then, itturns off the motor.
ROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.All other rights reserved.
Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
46/406
46
Wait forDarker
Use this icon to wait for the light reading todecrease by a certain value before moving to thenext command.
Example
This piece of code turns on motor A, then waits for thelight reading to decrease by 5 (the default). Then, itturns off the motor.
Wait forRotationw/o Reset
e
teenths, so a reading of 16is one rotation.
Use this icon to wait for a number ofrotations (or a fraction of a rotation) to bcompleted but do NOT want to reset therotation sensor to 0. (The general wait forrotation sensor resets to 0 and then waits forthe cutoff rotation.) The angle sensor valueis measured in six
Example
This piece of code turns on lamp A, waits for 1 rotation (areading of 16, the default) from the sensor, then turnslamp A off.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
47/406
47
Wait forAngle
Use this icon to wait for the angle sensor valueto be greater than the cutoff value before movingon to the next command. The rotation can beeither forward or backward. The default is 180
degrees, or half a rotation.
Example
This piece of code turns on lamp A. Once the angle sensorreads a value of greater than 180 degrees (the default),lamp A turns off.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, and
Wait forRotation sixteenths, so a reading of
ample
Use this icon to wait for the angle sensor valueto be greater than the value specified beforemoving on to the next command. The angle sensorvalue is measured in16 is one rotation.
Ex
This piece of code turns on lamp A. Once the angle sensorvalue reaches 16 (or one rotation, the default), lamp Aturns off.
ROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.All other rights reserved.
Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
48/406
48
NXTWaitforPush
Use this icon to wait for something to push inthe touch sensor before moving on to the nextcommand.
Example
This piece of code waits until the NXT touch sensor on Port
for 2
1 is pressed, in which case Motors A and C go forward untilthe touch sensor is pressed again. When it is pressed,Motor A will continue forward and Motor C will go backward
seconds, then both motors will stop.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, and
the new NXT touch sensor before moving on to thenexXTWaitForLet
Go
Use this icon to wait for something to release
t command. If the touch sensor is not pressedto begin with, the touch sensor must be pressedthen released.
Example
ROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.All other rights reserved.
Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
49/406
49
released, Motor A will continue forward and Motor Cwill go backward for 2 seconds, then both motors will stop.
This piece of code waits until the NXT touch sensor on Port1 is pressed. While it is pressed, Motors A and C goforward until the touch sensor is released. When it is
Use this icon to wait for the light reading tobecome greater than a certain value beforeoving on to the next comm
XTaitLight
and.
Example
Wform
This piece of code turns on Motor A, then waits for thelight sensor on Port 1 to read a value greater than 36.Then, it turns off the motor.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
50/406
50
NXTWaitforDark
Use this icon to wait for the light reading tobecome less than a
certain value before moving on to the nextcommand.
Example
This piece of code turns on motor A, then waits for thelight sensor to read a value less than 30. Then, it turnsoff the motor.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, and
NXTWaitforBrighter
increase by a certain value before moving to the
ample
Use this icon to wait for the light reading to
next command.
Ex
This piece of code turns on motor A, then waits for thelight reading to increase by 10. Then, it turns off the
ROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.All other rights reserved.
Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
51/406
51
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, and
.motor
NXT WaitforDarke
Use this icon to wait for the light reading todecrease by a certain value before moving to thenext command.
rExample
This piece of code turns on motor A, then waits for thelight reading to decrease by 10. Then, it turns off themotor.
ROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.All other rights reserved.
Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
52/406
52
NXTForwardDistanceX
Use this icon to wait for the distance sensor to
read a distance (in cm) that is greater than thenumber specified before moving onto the nextcommand.
Example
ece of code turns on Motor A, then waiThis pidistance
ts for thesensor to have a value of greater than 10, in
which case it stops. It then waits for the distance sensorto read a value less than 10. Next, it jumps back to thebeginning of the program and starts again.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
53/406
53
NXTReverseDistanceX
Use this icon to wait for the distance sensor toread a distance (in cm) that is less than the
number specified before moving onto the nextcommand.
Example
ece of code turns on Motor A, then waiThis pidistance
ts for thesensor to have a value of greater than 10, in
which case it stops. It then waits for the distance sensorto read a value less than 10. Next, it jumps back to thebeginn
ing of the program and starts again.
TWaitforLoud
Use this icon to wait for the sound sensor tonotice a volume greater than the specified cutoffbefore moving onto the next command.NX
Example
This piece of code turns on Motors A and C, then waits for
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
54/406
54
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, and
the sound sensor to notice a volume greater than 70, inwhich case Motors A and C reverse. It then waits for thesound sensor to read a value less than 35. Next, itjumps back to the beginning of the program and startsain.
ag
NXTWaitforQuiet
Use this icon to wait for the sound sensor tonotice a volume less than the specified cutoffbefore moving onto the next command.
Example
This piece of code turns on Motors A and C, then waits forthe sound sensor to notice a volume greater than 70, inwhich case Motors A and C reverse. It then waits for the
sound sensor to read a value less than 35. Next, it jumpsback to the beginning of the program and starts again.
ROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.All other rights reserved.
Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
55/406
55
NXTLouderUse this icon to wait for the volume to increase
by the cutoff value before moving onto the nextcommand.
Example
This piece of code turns on Motors A and C, then waits fothe volume to in
rcrease by 15, in which case Motors A and C
It then waits for the volume to decrease by 20.Next, it jumps back to the beginning of the program andstarts again.
reverse.
NXTQuieter
icon to wait for the volume to decreaseby the cutoff value, before moving onto the next
command.
ample
Use this
Ex
This piece of code turns on Motors A and C, then waits forthe volume to increase by 15, in which case Motors A and Creverse. It then waits for the volume to decrease by 20.Next, it jumps back to the beginning of the program andtartss again.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
56/406
8/3/2019 Rl-ReferenceGuide
57/406
57
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, and
be completed but do NOT want to reset therotation sensor to 0. (The general wXT
rRotationw/oReset
Use this icon to wait for a number of degrees to
ait fortation sensor resets to 0 and then waits for
the cutoff degree.)
Example
Wait rofo
This piece of code turns on Lamp A, waits for 720 degreesfrom the sensor, then turns Lamp A off.
ROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.All other rights reserved.
Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
58/406
58
Wait forDecreasingTemp (C)Wait forIncreasingTemp (C)
Wait forDecreasingTemp (F)Wait forIncreasingTemp (F)
Use these icons to wait for the temperature sensor toread a value less (Wait for Increase) or greater than(Wait for Decrease) than the cutoff temperaturespecified before moving on to the next command.
Example
This piece of code turns on lamp A,then waits for thetemperature sensor to read above 30 degrees Celsius (thedefault). After that it plays a sound and turns off thelamp.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
59/406
59
Use this icon to wait for the value of acontainer to be equal to some number beforemoving on to the next command.Wait for
Conta ampleinerEx
This piece of code empties the red (default) container.
Then it turns on motor A. It waits for the container valueto equal 1 (the default), and when it does, it turns offmotor A and stops all tasks. At the same time, a secondtask is filling the container with the value of the touchsensor. In essence, this program waits for the
touch sensorto be pressed, and then turns off the motor.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, and
Wait forMail
for mail before moving onto the next command.
Example
Use this icon to wait
mail. Once the mail is received, it turns off motor A.This piece of code turns on motor A and waits to receive
ROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.All other rights reserved.
Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
60/406
60
Wait forClock
Use this icon to wait for the clock on the RCX toreach a certain time value in minutes beforemoving on to the next command. Useful if you do
not want the RCX to stay on too long to conservebatteries.
Example
This piece of code turns on lamp A and waits for the RCXclock to reach 1 minute (the default), then turns off thelamp.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
61/406
61
Use this icon to wait until the clock reaches acertain time (measured in tenths of seconds)before moving on to the next command. Always usea zero timer command prior to this command.
Wait forTimerExample
This program zeros the red timer and turns on motor A. Thenit waits for the red timer to reach 1 second (the default),after which it stops motor A.
WaitforTimer
Use this icon to wait until the timer (read inhundredths of seconds) reaches a certain timebefore moving on to the next command. Always usea zero timer command prior to this command.
Example
This program zeros the red timer then it waits for the redtimer to reach 600 hundredths of seconds, after which itbeeps.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
62/406
62
Wait for Increasein Camera Sensor
Wait for Decreasein Camera Sensor
Use these icons to wait until the camera sensor readsa value higher (Increase icon) or lower (Decreaseicon) than the compare to number before moving on tothe next command.
Example
This piece of code would turn on motor A. When the camerasensor reads a value of greater than 55 (the default), Themotor would turn off and the RCX would play a sound.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
63/406
63
Wait for Decreasein Voltage(Generic)
Wait for Incin Voltage rease(Generic)
Use these icons to wait until the sensor reads avoltage of less than (Wait for Decrease icon) orgreater than (Wait for Increase icon) the cutoffvoltage specified before moving on to the nextcommand.
Example
This piece of code would turn on motor A. When the sensorreads a value of less than 2 Volts (the default), motor Awould turn off.
Wait forDecreasingHumidityWait forIncreasingHumidity
Use these icons to wait until the sensor reads a valueof less than (Wait for Decrease icon) or a value ofgreater than (Wait for Increase icon) the cutoffhumidity percentage before moving on to the nextcommand.
Example
This piece of code would turn on motor A. When the sensoreads a value of less than 5
r0% humidity (the default),
motor A would be shut off.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
64/406
64
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, and
Wait forDecreasing pH Wait for DecreasingpH
the cutoff pH before moving on to the
ample
Use these icons to wait until the sensor reads a valueof less than (Wait for Decrease) or greater than (Waifor Increase) tnext command.
Ex
r
ater than 7 (the default), motor Awould be shut off.
This piece of code would turn on motor A. When the sensoreads a value of gre
Wait for PositionIncrease Wait for PositionDecreaselue
cutoff position before moving on to the next command.
ample
Use these icons to wait until the sensor reads a va
of less than (Wait for Position Increase icon) orgreater than (Wait for Position Decrease icon) the
Ex
This piece of code would turn on motor A. When the sensorreads a value of less than 180 degrees (the default), the
motor would be shut off.
ROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.All other rights reserved.
Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
65/406
65
Wait forIncreasingPressure
Wait forDecreasingPressure
Use these icons to wait until the sensor reads a valueof less than the cutoff pressure before moving on tothe next command.
Example
This piece of code would turn on motor A. When the sensorreads a value of less than 100 kPa (the default), the motorwould be shut off.
Wait forIncreasing SoundLevelWait forDecreasing SoundLevel
Use these icons to wait until the sensor reads a valueof less than (Wait for Increase icon) or greater than(Wait for Decrease icon) the cutoff sound level beforemoving on to the next command.
Example
This piece of code would turn on motor A. When the sensor
reads a value of less than 60 decibels (the default), themotor would be shut off.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
66/406
66
Wait forIncreasingTemperature (C)Wait for Decrease
icon) or greater than
to the next command.
Example
in Temperature (C)
Use these icons to wait until the sensor reads a valueof less than (Wait for Increase(Wait for Decrease icon) the cutoff temperature beforemoving on
This piece of code would turn on motor A. When the sensorreads a value of less than 30 degrees Celsius (thedefault), the motor would be shut off.
Wait for Increasein Voltage Wait for Decreasein VoltageUse these icons to wait until the sensor reads a valof less than (Wait for Increase
ueicon) or greater than
to the next command.(Wait for Decrease icon) the cutoff voltage beforemoving on
Example
This piece of code would turn on motor A. When the sensorreads a value of less than 2V (the default), the motorwould be shut off.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
67/406
67
Tasks & Subroutines(Structures)Use this icon to start a new task. The tasks runsimultaneously. Each task needs an End icon(stoplight).TaskSplit ampleEx
This piece of code turns on motor A. After 2 seconds itflips directions, and after 4 seconds from the beginning (2seconds from flip) it turns off motor A.
artTaskis
o restart a
Example
Use this to restart tasks after they have beencompleted or stopped. The Task Number modifier
only necessary if you only wish tSt certain task and not all tasks.
This piece of code turns on motor A and lamp B. If 6seconds pass and the touch sensor has not been pressed, theRCX will play a noise and turn off lamp B. Then both taskswill be restarted from the task split. If the touch sensoris pressed within 6 seconds, both tasks will be stopped and
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
68/406
68
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, and
the program ends.
Delete eber modifier is only necessary if youwant to delete only a certain task and not all
ks.
Example
Use this in direct mode ONLY. Use this icon to
clear the RCX of any tasks it previously had. ThTask NumTaskstas
This piece of code deletes all tasks then turns on motor A
for 2 seconds and turns it off.
opTaskssk Number modifier is only
necessary if you want to stop a certain task andall ta
Example
Use this to stop tasks that may still be inprogress. The Ta
St not sks.
This piece of code turns on motor A and lamp B. If 6seconds pass and the touch sensor has not been pressed, theRCX will play a noise and turn off lamp B. Then both taskswill be restarted from the task split. If the touch sensoris pressed within 6 seconds, both tasks will be stopped andthe program ends.
ROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.All other rights reserved.
Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
69/406
69
CreateSubroutine
Use this to define a subroutine. This does NOTstart the subroutine. Each subroutine needsits own end (stoplight) icon. The main taskwill continue running by itself until a Run
Subcommand is reached.
Example
This piece of code turns on motor A. After 4 seconds it
plays 3 notes and then turns off the motor.
Use this to start a subroutine. You mustdefine the subroutine before using thiscommand.
StartSubroutineExample
This piece of code turns on motor A. After 4 seconds itplays 3 notes and then turns off the motor.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
70/406
70
Use this in direct mode ONLY. Use this icon toclear the RCX of any subroutines it previouslyhad.
DeleteSubroutineExample
This piece of code clears the RCX of any subroutines andthen turns on motor A for 2 seconds and turns it off.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
71/406
71
Forks
TouchSensorFork
Use this fork if you want to take differentcourses of action based on a touch sensor. A forkmerge is required at some point after this icon.
Example
This piece of code would turn on motor A. If, after 4seconds, the touch sensor is pushed, the RCX will play asound and shut off the motor. Otherwise, the motor willjust be turned off (no sound).
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
72/406
8/3/2019 Rl-ReferenceGuide
73/406
73
NXTSoundSensorFork
Use this fork if you want to take differentcourses of action based on volume, as read by the
NXT sound sensor fork. A fork merge is requiredat some point after this icon.
Example
This piece of code checks the volume of a room as read by the sound sensor. If the volume is greater than 40, a sound is playit is less than 40, Motor A runs in reverse for two seconds. Ijumps back to the beginning of the code to start again.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
74/406
74
NXTDistanceSensorFork
Use this fork if you want to take differentcourses of action based on distance from thesensor (in cm), as read by the NXT distance
sensor fork. A fork merge is required at somepoint after this icon.
Example
This piece of code runs Motor A in reverse if the distancesensor reads a value of less than 10. It continues goingbackward (because of the red jump and land) until thedistance sensor reads a value greater than 10, in whichcase it will run Motor A forward until a distance of 10 isreached again. This process continues over-and-over.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
75/406
75
NXTRotationSensorFork
Use this fork if you want to take differentcourses of action based on the NXT rotationsensor. A fork merge is required at some point
after this icon.
Example
This program waits 1 second, then if the rotation sensor onPort A reads less than 720 degrees, Motor A goes forward.This continues (because of the red jump and land) until the
rotation sensor reads above 720 degrees, in which case itwill stop Motor A, play a sound, and reset the angle sensorto zero.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
76/406
76
NXT LightSensorFork
Use this fork if you want to take differentcourses of action based on a light sensor. A forkmerge is required at some point after this icon.
Example
This piece of code turns on Motor A for 4 seconds if theNXT light sensor (on Port 2) reads a value of below 55. Ifthe value is greater than 55, a sound is played.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
77/406
77
NXT ClickFork
Use this fork if you want to take differentcourses of action based on the number of clickson a touch sensor. A fork merge is required atsome point after this icon. Also, a zero clicks
sensor command should be used sometime beforethis icon.
Example
This piece of code first resets the click counter to zero.It then turns on Motor A for 10 seconds, and will shut itoff for two seconds if the click counter has a value ofless than 5. If it is greater than five, it plays a sound.It then jumps back to the beginning and starts again.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
78/406
8/3/2019 Rl-ReferenceGuide
79/406
8/3/2019 Rl-ReferenceGuide
80/406
80
Use this fork if you want to take differentcourses of action based on the value of a timer.A fork merge is required atTFoimerrk
some point after thisicon.
Example
This piece of code turns on lamp A for a random amount oftime, and then turns it off. If the time is less than 3seconds, the RCX plays a sound.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
81/406
8/3/2019 Rl-ReferenceGuide
82/406
8/3/2019 Rl-ReferenceGuide
83/406
83
ClickFork
Use this fork if you want to take differentcourses of action based on the number of clickson a touch sensor. A fork merge is required atsome point after this icon. Also, a zero clicks
sensor command should be used sometime beforethis icon.
Example
This piece of code turns on motor A for 10 seconds, then
shuts it off. If after 10 seconds the touch sensor has beenlickc ed more than 10 times, it plays a sound.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, and
TouchandReleaFork
mber of touchesand releases on a touch sensor. A fork merge is
uired at some point after this icon. Also, azero touch and release sensor command should beused sometime before this icon.
Use this fork if you want to take differentcourses of action based on the nu
se req
Example
This piece of code turns on motor A for 10 seconds, andthen shuts it off. If after 10 seconds the touch sensor hasbeen touched and releases more than 10 times, it plays asound.
ROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.All other rights reserved.
Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
84/406
84
DataPointsFork
Use with Investigator commands. Use this fork ifyou want to take different courses of actionbased on the number of points gathered. A forkmerge is required at some point after this icon.
Example
This piece of code logs light sensor data points for a
random time. If after that time there are 5 (the default)or fewer data points, it logs data for 2 more secondsbefore stopping. If after the random time there are greaterhant 5 data points, it stops logging points.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, and
lockFork
Use this fork if you want to take differentrses of action based on the value of the RCX
clock. A fork merge is required at some pointafter this icon.
cou
Example
This piece of code would check the value of the RCX clock.If the clock read 1 minute (the default) or less, thenmotor A would turn on for 8 seconds.
ROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.All other rights reserved.
Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
85/406
8/3/2019 Rl-ReferenceGuide
86/406
8/3/2019 Rl-ReferenceGuide
87/406
87
HumiditySensor Fork pH SensorFork PressureSensorFork
Sound LevelSensor Fork
TemperatureSensor Fork PositionSensorForkVoltage Fork
fk
merge is required at some point after this icon.
ample
Use this fork if you want to take different courses oaction based on the value of a LogIT sensor. A for
Ex
This piece of code would play a sound if the value of thehumidity sensor was less than or equal to 50% (thedefault).
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
88/406
88
CelsiusEqualFork
Use this fork if you want to take differentcourses of action based on a temperature sensor.A fork merge is required at some point after thisicon.
Example
This pi
e
ece of code waits one second and reads the
fault), it will play a sound.temperature. If the temperature is not 30 degrees Celsius(the d
cocontainer. A fork merge is required at someContainerEqual Fork
Use this fork if you want to take differenturses of action based on the value of a
point after this icon.
Example
This piece of code fills a container with a random number.If that number is not equal to 1 (the default), the RCXplays a sound.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
89/406
8/3/2019 Rl-ReferenceGuide
90/406
90
FahrenheitEqual Fork
Use this fork if you want to take differentcourses of action based on a temperaturesensor. A fork merge is required at somepoint after this icon.
Example
This piece of code waits one second and reads thetemperature. If the temperature is not 80 degrees
ahreF nheit (the default), it will play a sound.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, and
ilbEqualForkcourses of action based on the value of the
lbox. A fork merge is required at some pointafter this icon. Also, an empty mailbox commandshould be used sometime before this icon.
Use this fork if you want to take different
Ma oxmai
Example
of 1 (the default), the RCX plays a sound.
This piece of code empties the mailbox and then waits 10seconds. If after those 10 seconds the mailbox has a value
ROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.All other rights reserved.
Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
91/406
91
RotationSensorEqualFork
Use this fork if you want to take differentcourses of action based on a rotation sensor. Afork merge is required at some point after thisicon. Also, a zero angle sensor command should be
used sometime before this icon. Reminder:rotation sensor reads in sixteenths, so a readingof 16 equals one rotation. Rotation can be eitherforward or backward.
Example
This piece of code zeros the angle sensor. If after 10seconds the angle sensor reads 16 (one rotation, thedefau
lt), then the RCX plays a sound.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, and
ClickualForkensor. A fork merge is required at
some point after this icon. Also, a zero clickssor command should be used sometime before
this icon.
ample
Use this fork if you want to take differentcourses of action based on the number of clickson a touch s
Eqsen
Ex
This piece of code zeros the click sensor. If after 10seconds the click sensor reads 10 (the default), the RCXplays a sound.
ROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.All other rights reserved.
Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
92/406
92
TouchandReleaseEqualFork
Use this fork if you want to take differentcourses of action based on the number of touchesand releases on a touch sensor. A fork merge is
required at some point after this icon. Also, azero touch and release sensor command should beused sometime before this icon.
Example
This piece of code zeros the touch and release sensor. Ifafter 10 seconds the touch and release sensor reads 10 (thedefault), the RCX plays a sound.
NXTSound
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, and
SensorEqualFork
courses of action based on the volume of a room,as measured by the NXT sound sensor. A fork mergeis required at some point after this icon.
ample
Use this fork if you want to take different
Ex
iece of code turns on motor A. If the sound sensorot read a value of 55, then the RCX plays a s
This ps n ound.er 2 seconds, the motor is shut off.
doeAft
ROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.All other rights reserved.
Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
93/406
93
DistanceSensoEqualFork
Use this fork if you want to take differentcourses of action based on the volume of a room,as measured by the NXT sound sensor. A fork merge
Example
NXTr is required at some point after this icon.
This piece of code turns on Motor A in reverse if thevolume is not equal to 10. If the volume is equal to 10, asound is played. The code then jumps back to the beginningto start again.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
94/406
8/3/2019 Rl-ReferenceGuide
95/406
95
NXTLightSensorEqualFork
Use this fork if you want to take differentcourses of action based on a light sensor. Afork merge is required at some point afterthis icon.
This piece of code turns on motor A. If the light sensordoes not read a value of 55, then the RCX plays a sound.After 2 seconds, the motor is shut off.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
96/406
96
NXTClickEqualFork
Use this fork if you want to take differentcourses of action based on the number of clickson a touch sensor. A fork merge is required atsome point after this icon.
Example
This piece of code will turn Motor A on at Power Level 10for 1 second if the value of the click count sensor is notequal to 10. If it is equal to 10, Motor A will stop for 1second, a sound will played, and the click sensor will bereset to zero. This code then jumps back to the beginningto begin again.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
97/406
8/3/2019 Rl-ReferenceGuide
98/406
98
DataPointsEqualFork
Use with Investigator commands. Use this fork ifyou want to take different courses of actionbased on the number of points gathered. A forkmerge is required at some point after this icon.
Example
This piece of code logs light sensor data points for 6seconds. If after that time there are not 5 (the default)data points, the RCX plays a sound before stopping. Ifafter the 6 seconds there are 5 data points, it stopslogging points (no sound).
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, andROBOLAB are trademarks of the LEGO Group. This page may be photocopied for non-commercial educational use.
All other rights reserved.Visit www.lego.com/education & www.legoengineering.com
8/3/2019 Rl-ReferenceGuide
99/406
99
ClockEqualFork
Use this fork if you want to take differentcourses of action based on the value of the RCXclock. A fork merge is required at some pointafter this icon.
Example
This piece of code would check the value of the RCX clock.If the clock did not read 1 minute (the default), thenmotor
A would turn on for 8 seconds.
2002 LEGO, LEGO Educational Division, LEGO Mindstorms for Schools, and
Cameranso rqualFork
camera sensor. A fork merge is required at somepoint after this icon.
ample
Use this fork if you want to take differentcourses of action based on the value of the
SeE
Ex
then turn it off. The direction of the motor is determinedby the value of the camera sensor. If the camera value is55 (the default), the motor goes forward. Otherwise, themotor goes in the reverse direction.