DOWNLOAD
Syntax DOWNLOAD word or list
Explanation DOWNLOAD is used to send procedures to the RCX robot controller. The RCX can be loaded with up to ten procedures. Each procedure runs independently and at the same time. Pressing the Run button on the RCX starts procedure 0, which again may start other procedures.

Logo uses DOWNLOAD to compile a Logo procedure and download it to the RCX device for later execution independent of Logo or the computer. Such a procedure may only contain RCX names and commands, plus the commands IF (without ELSE), WHILE, REPEAT, RCX.PLAY, MAKE and STOP. Procedures may not call other procedures, but tail recursion is supported.

The following example is a Logo procedure that causes the RCX device to run forward until it hits a wall (provided that sensor #1 is connected to a switch):

TO RUN.UNTIL.HIT
SETSENSOR 1 "SWITCH
MOTOR [1 2] 100
WHILE [.SENSOR1 = 0] []
MOTOR [1 2] "FALSE
END

The DOWNLOAD command takes a procedure name or a list of up to ten procedure names. These procedures are compiled and downloaded to the RCX device as procedures numbered 0 through 9. After a successful download, the command RCX.LAUNCH launches procedure number 0. In order to execute the above procedure as a downloaded procedure, issue the following two commands:

DOWNLOAD "RUN.UNTIL.HIT
RCX.LAUNCH

If the DOWNLOAD command detects that a procedure cannot be executed on the RCX device, it stops and prints a corresponding error message. A common error is to use normal Logo variables not defined as RCX variables.

Examples DOWNLOAD "FOO
DOWNLOAD [FOO BAR]
Unknown RCX name in BAR: MYVAR

TopIndex