Robojoy challenge class

2-1.Using the intelligent block


Addition using the variable

Let's make further improvements to the program.
Add four more blocks to the calculated program 2.

Create a variable in the following ways. The variable is the "container" of the value.
Select the "Edit"→ "Define variable" from the menu.

Name "variable_1", set to data type "Number" and press the "Create" button. In addition, Name "variable_2", set to data type "Number" and press the "Create" button.

Place two variable blocks. Set a block as "variable" on the screen, select the list as "variable_1". And another block set up for "variable_2".

Block of the"variable_1"and "variable_2"place the same pair again. The variable blocks are four in total. Set the radio button of "work" for "write" to the left two variable blocks. The right two variable blocks is set to "read" radio button.

At calculated program 2, it was contained the program for addition, but this program get the value from a variable.

By the way, data wire can be crossed like this way. There is no problem, but just hard to see.

Please note that it will become an error if the block did not ride the sequence bar.

If it would run well, the calculation results as shown in the picture will be displayed.
"2"the correct answer was displayed. What is displayed on the screen and the calculated program 2 is the same.

[Download] Calculated Program 3 (for the NXT software)