LEGO Engineering

| | | | | | | |
How do you wire in a number (or constant)?


23rd of April, 2010

(2 )
100% thumbs up 0% thumbs down

Under modifiers wire_constants_pic_1first.jpg there is a blue box  wire_constants_pic_2first.jpg labeled 'numeric constant'. (The name of this - and any other - tool should appear at the top of the toolbar.) Drag the numeric constant box to an appropriate location.

Once the constant is placed on the screen, press the spacebar (to change to the wire tool if not already selected), and wire the constant box to the icon by first clicking on one, then the other.  Be careful, as certain functions need to have multiple constants wired in and it is easy to wire the constant to the wrong location.

Below is a 'wait for time' icon set to wait for 10 seconds. The constant, 10, is wired to the icon and is located below it in a blue box.

wire_constants_pic_1.jpg

There is one other type of constant, which is a number including a decimal.  These types of constants are known as doubles, and are wired in just like regular constants.  Wiring in a double works fine with timer values:

wire_constants_pic_2.jpg

Wiring in 10.65 will make this wait for command wait for 10.65 seconds.

However, integers (numbers without decimals) are the only things allowed in containers.  For example, if you were to put the following into ROBOLAB, the value in the red container would be 10 (not 10.65).

wire_constants_pic_3.jpg

For ways to exploit this constraint, see the question entitled, "How can a program be written to tell the difference between even and odd numbers?"





AG
ses

kw

   :
   :
* :
* :
 


Home | About Us | Contact Us

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