Figure 3. Add three switches set to "NXT Buttons" for the
sensor. Set the first switch to the left arrow; the second
to the right arrow; and the third to the Enter button.
Figure 5. Add the same Steer variable block to the right NXT
button switch. This time, set it to -100 for a full right turn.
Figure 7. Add a variable block to the end of the program and
set it to the Steer variable. Next, find and add a Send Message
block to the end of the program from the Actions menu. Set the
connection number to 1, the message to logic, and the mailbox
to 1. Wire the value from the variable block to the number data
hub on the Send Message block. You'll have to connect the two
NXTs via Bluetooth manually, at which point you choose the
connection number. The mailbox number is where the data is
sent, and we'll use it later to tell Eddie where to look for those
Figure 4. Add a variable block to the side of the left arrow
switch where the button is pressed. Set that block to the
variable Steer and set it to write. Finally, set the value to 100.
Recall that "steering" can be controlled by an integer between
-100 and 100; -100 is a full right turn (it's reversed from a full left
turn since Eddie has a gear train); 100 is a full left turn. When
the left arrow is pressed, we'll ultimately want Eddie to turn left.
Figure 6. Again, add the Steer variable block to the Enter
button switch. This time, set it to 0 to make Eddie go straight
forward when the Enter button is pressed.
Figure 8. Add a variable block and set it to the Stop variable.
Add another Send Message block, and this time set it to
connection port 1, message "Number," and mailbox 2. Then,
connect the value from the variable block to the logic data hub
on the Send Message block.
64 SERVO 06.2011