Writing Eddie’s Program
We’re halfway there! Now, we just need to program Eddie to understand the Bluetooth messages.
Bot Test Program Instructions
Figure 1. Create a new program called BT_Bot_Test. Define a
number variable called Steer and a logic variable called Stop —
these are the same variables from the Control program.
Figure 2. Add a loop. Inside the loop, add a Receive Message
block from the Sensors tab. Set the mailbox to 1 and set it to
the Number Out data hub to write to a Steer variable block.
Figure 3. Repeat the same process as Step 2, but set the
mailbox to 2 and the variable to Stop. Wire the Logic Out data
hub to the Stop variable.
Figure 5. If "Stop" is set to true (meaning the touch sensor is
being pressed), we want Eddie to stop moving. Add a Move
block set to Stop on the true side of the logic switch.
Figure 4. Add a Stop variable block set to read and wire it to a
switch set to logic. This will allow us to make Eddie react
differently if the touch sensor is being pressed (meaning "Stop"
is set to "true”) than if the touch sensor isn't being pressed
(meaning "Stop" is set to "false").
Figure 6. Add a Steer variable block to the false side of the
SERVO 06.2011 65