User Tools

Site Tools


logo:programming_bluebot

Programming the Blue-Bot

Blue-Bot is Bee-Bot's big brother. It almost looks like Bee-Bot, but it has a transparent shell. Blue-Bot offers a programming interface, however, which is based on a Bluetooth connection - a wireless connection that works over a distance of up to about 30 ft (10 m).

If your PC or Mac has a built-in Bluetooth radio (most modern PCs and Macs do), you can use Terrapin Logo to control Blue-Bot from your PC or Mac. This page provides step-by-step instructions to help you get connected to Blue-Bot. Using Terrapin Logo to control Blue-Bot offers more commands than just the buttons. Blue-Bot can turn in 45-degrees increments, and a simple repeat loop is available as well.

First, download and install a copy of Terrapin Logo. Note that the free-to-try version does not let you execute any code on Blue-Bot. You need to purchase and install a license before you can actually run any code on Blue-Bot. Note that you must have version 4.1 of Terrapin Logo. Older versions do not support the Blue-Bot commands. If you are not sure which version you have installed, use the VERSION command to display the program version.

Then, turn on Blue-Bot and connect it to your computer.

Finally, use the BLUEBOT.OPEN command to open the connection to your Blue-Bot, and program away!

Install your Blue-Bot

Before you can work with Blue-Bot, you need to connect it to your computer. This means to turn on Blue-Bot, and to use your computer's settings to connect to Blue-Bot.

It is possible to use Windows XP SP2 to connect to a Bluetooth device. We did not test this feature, however. Please refer to your Windows XP documentation to read about how to connect a Bluetooth device.

Install on a Windows 8 PC

  1. On the Metro desktop, move your mouse to the lower right corner, until the right side band pops up. Click Settings.
  2. The Settings pane pops up. At the bottom, click Change PC Settings.
  3. The PC Settings window opens. Select Bluetooth. If all goes well, and you have Blue-Bot turned on, you will now see Blue-Bot in the list of visible Bluetooth devices.
  4. Click BlueBot, and click Pair. This will take a while, while drivers are being installed.
  5. Finally, the text underneath BlueBot will read Connected. Congratulations! You have just connected your Blue-Bot!

Install on a Windows 7 or Vista PC

  1. On the Start Menu, click Devices and Printers.
  2. The Devices Connection Wizard appears. Click Add Device.
  3. The Devices Connection Wizard will now search for visible Bluetooth devices.
  4. As soon as the BlueBot device appears (do not worry because it disguises itself as a headset), click the device, and click Next. Another screen appears where you can watch the progress of the driver installation.
  5. Finally, the Devices and Printers wizard displays the connected Blue-Bot “headphone”.

Install on a Mac

Your Mac needs to support the Bluetooth 4 Low Energy profile (BT4LE). Most newer Macs support this profile out of the box. If they don't, you need to buy a Bluetooth dongle that supports BT4LE; these dongles are not expensive. Just plug it into any USB port on your Mac, and you should be good to go. Do not worry about the speaker symbol; your Mac thinks that Blue-Bot is a sound device.

Open System Preferences, select the Bluetooth panel, and turn on your Blue-Bot. It should appear as follows:

If the “Pair” button reads “Connect”, you probably have a Mac that supports BT4LE. Click that button. If all goes well, you will see a success message:

If the “Pair” button does not cause any connection, and the little wheel spins forever, you need a Bluetooth dongle.

Please note that the BLUEBOT? and BLUEBOT.OPEN Logo commands open a very similar dialog if you did not connect Blue-Bot via the System Preferences panel. On Mac OS X 10.10.3 (the latest Yosemite version), we found that Terrapin Logo crashed sometimes when attempting to show the dialog; we recommend that you use the System Preferences panel to connect to Blue-Bot.

Testing the Blue-Bot Installation

Launch Terrapin Logo and enter the commend BLUEBOT?. If the command responds with TRUE, Terrapin Logo has found the installed Blue-Bot driver.

Blue-Bot Programming

You are now ready to program your Blue-Bot. Before you issue any Blue-Bot commands, you need to open the Blue-Bot connection. Enter the command BLUEBOT.OPEN to open the connection. Once the connection is established, Blue-Bot's eyes turn blue, and its buttons are disabled. Now, Blue-Bot listens to your commands.

If you want Blue-Bot to resume normal operation, enter the BLUEBOT.CLOSE command. After a while, Blue-Bot's eyes turn white again, and its buttons work again.

If you have to stop a runaway Blue-Bot program, there is only one way: lift Blue-Bot, and turn it off and on again. This also breaks the connection between Terrapin Logo and Blue-Bot; you will have to re-issue the BLUEBOT.OPEN command to re-open the connection.

First Steps

The BLUEBOT.RUN command lets you issue a quick set of commands to Blue-Bot, which Blue-Bot executes immediately. The command takes a list of commands. To make Blue-Bot run in a square, for example, try this command:

BLUEBOT.RUN [REPEAT 4 [FD 1 RT 90]]

Blue-Bot stores a maximum of up to 200 commands. Please note that a Logo command may consume more than one Blue-Bot command. If you get an error message that your code is too complex, consider using a repeat loop, or fewer movements. A FD 10 command, for example, would store 10 FD commands into Blue-Bot's memory.

Blue-Bot does not understand many commands. The following table provides an overview over all available Logo commands that Blue-Bot understands.

FORWARD Blue-Bot moves forward in fixed-size units. A value of 1 does not mean a single pixel as the screen turtle, but one Blue-Bot movement unit, which is about 6 inches (15 cm). If you, for example, use the command FD 2, Blue-Bot will move forward one unit, stop briefly, and then move forward a second unit.
BACK As with the FORWARD command, Blue-Bot moves backwards in the same way that it moves forward. If you use negative values as input to BACK, Blue-Bot moves forward and vice versa.
LEFT Blue-Bot turns left or right in 45-degree increments. Terrapin Logo calculates the amount to turn in as few commands as possible. Therefore, Blue-Bot may make brief stops while turning.
RIGHT The same limitations that are valid for the LEFT command also apply to this command. As with FORWARD and BACK, negative values make Blue-Bot turn in the opposite direction.
WAIT This command corresponds to Blue-Bot's Pause button. Blue-Bot pauses in units of about two seconds. Therefore, the input to WAIT (which is a millisecond value) should be a multiple of 2000. Terrapin Logo rounds wait times up to the nearest multiple of two seconds.
REPEAT Blue-Bot has a simple built-in repeat feature that lets it execute a list of commands between 1 and 16 times. The REPEAT command cannot be nested.

Advanced Programming

Often, you will want to store commands in a procedure to execute them repeatedly. Unfortunately, Blue-Bot does not support procedures. What you can do, however, is to create a procedure that contains all of the Blue-Bot commands. You can then use the BLUEBOT.WRITE command to download this procedure to Blue-Bot. Blue-Bot will not execute these commands immediately. Instead, you can enter the command BLUEBOT.GO, which is the equivalent of pressing Blue-Bot's GO button.

Here is the above example as a procedure:

TO MY.BLUEBOT
    REPEAT 4 [FD 1 RT 90]
END
MY.BLUEBOT defined 
BLUEBOT.WRITE "MY.BLUEBOT
BLUEBOT.GO

Blue-Bot Command Summary

For a detailed description, please click one of the commands below.

BLUEBOT? Checks if the Blue-Bot drivers are installed. Outputs either TRUE or FALSE.
BLUEBOT.OPEN Opens the Blue-Bot connection. Outputs either TRUE or FALSE. If the connections fails to open, check if Blue-Bot is turned on.
BLUEBOT.CLOSE Closes the Blue-Bot connection.
BLUEBOT.WRITE Downloads a procedure to Blue-Bot. Any errors in the commands are displayed as runtime errors. Note that the procedure must not have any inputs, and that it may only contain valid Blue-Bot commands.
BLUEBOT.RUN Downloads and runs its input, which is a list of Logo commands that Blue-Bot can understand. Any errors in the code are displayed as runtime errors.
BLUEBOT.GO Causes Blue-Bot to execute a previously written procedure; equivalent to pressing the GO button, which is disabled when a connection is open.
BLUEBOT.CLEAR Clears Blue-Bot's memory; equivalent to pressing the CLEAR button, which is disabled during an open connection.
BLUEBOT.STATUS Outputs a three-element list. The first two elements are usually TRUE, but may be FALSE if one of Blue-Bot's motors are stalled; the third element is the battery level, which is a number between 0 and 1.
logo/programming_bluebot.txt · Last modified: 2019/01/22 06:09 (external edit)