When run, this code will cause a car to snake forward in wide arcs.
The length of the turn can be modified by changing either the time,
or the motor power.
Two RCX's can be programmed to communicate with each other using
the mail function. Mail represents the passing of integer values
between separate RCX's using the IR port. In this example, the same
code is used for both the receiver and the sender, so that you may
interchange the roles of two RCX's without having to re-program
them.
The top half of the first split is the receiving algorithm. Each
RCX will wait to receive mail from the other. Once this happens,
the integer value received will be placed into the red container.
The value is then displayed and the RCX beeps a corresponding number
of times. The RCX then waits for mail again.
The bottom half of the first split is the sending algorithm. The
user can enter in a mail value to send by pressing touch sensor
1 the desired number of times. For example, if number 3 was to be
sent, touch sensor 1 would be pressed 3 times. Once this value is
programmed, pressing touch sensor 2 will send the mail out. In general,
mail is a useful way for RCX's to pass information to one another.
It can be used to trigger responses, send positions, or pass container
values.
Like its smaller cousin, the three-button remote control is a
great way to define unique behaviors for your robot. The advantage
to the three-button control is that there are now 8 possible behavior
combinations, compared to just 4 on the 2-button remote. In addition
to forward, left and right motion on our two motor car, it is now
possible to move in reverse, and even control a third motor. With
so many combinations, it is possible that you don?t need them
all. In a case like that, simply wire the fork branch you don?t
want to control straight into the merge fork block. If the program
travels along that branch, it will simply jump back to the beginning
again.