Introduction to Logo Blocks


 

LogoBlocks lets you create iconic programs to control a Programmable Brick, the yellow RCX. To create programs, you just drag blocks from the palette (on the left of the screen) and snap them together on the canvas (on the right side of the screen). The buttons on the bottom left let you switch between palettes, each containing a different set of commands. All programs must be attached to a purple "hat". For example, create this program:

 

This program tells the RCX brick
to beep
then wait for one second,
then beep again.

To execute the program,
double-click on the purple "hat".

 

 

When you execute a program (by double-clicking on the purple hat), you will notice lights flashing on the yellow RCX brick and the interface tower, indicating that they are communicating with one another.


Now, connect a motor to the A port on the RCX brick, and create the following program:

This program
tells motor-a
to turn on for one second,
then reverse direction ("rd"),
then turn 2 seconds in the other direction.

(Note: To change the number on a block, simply click on the block and type in the new number when it turns red)

 


Now add a second motor, connecting it to the B port.

This program
tells both motors
to repeat a set of commands eight times.
The motors will turn on for one second,
then reverse direction,
then turn on for another second,
then reverse direction,
then turn on...

(Note: To get the ab, block, simply click on the a, block several times.)

 


Now connect a touch sensor to sensor port 1.

This program tells the RCX brick
to wait until the touch sensor is pressed,
and then turn on motor-b
for two seconds

 


Now connect a light sensor to the sensor port 2.

This program tells the RCX brick
to wait until the light sensor gets a reading of less than 100,
then to turn on motor-a
for two seconds.

(Note: The light sensor always reports a value between 0 and 255. Also, to throw away the switch1 attached to waituntil, you should pull it offscreen, then replace it with a blue less-than block from Math.)

 

Note that the purple hat in this program has a green button. This plays a special role in LogoBlocks: it is automatically linked to the green "Run" button on the RCX brick. When you press the Run button, the RCX brick runs the program attached to the purple hat with the green button.

Try the following: Select "Download Code" from the "LEGO RCX" menu to download your program to the RCX brick. Then take the RCX brick away from the computer and press the green "Run" button: the RCX brick should run your program.