using numbers with the NXT-G 2.0 switch block

One of the major differences between NXT-G 1.1 and NXT-G 2.0 is the change from using only whole numbers to using floating-point numbers, and this affects how the Switch block works. Even though NXT-G 2.0 supports floating-point numbers, you can use only whole numbers for the items in the Conditions list. The Switch block will round the value on the input data wire to the nearest whole number before comparing it with the list of values. For example, using the values shown earlier in Figure 9-16 (10, 75, and 125), any value greater than or equal to 74.5 and less than 75.5 will be rounded to 75 and so ...

Get The Art of LEGO MINDSTORMS NXT-G Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.