Terrapin Resources

Connect to Robots

An app that runs inside a browser like Logo cannot easily access anything on your computer for obvious security reasons. Or how would you like a web page that can read all of your data stored on your disk without you even noticing?

There are many different browsers that you can use. Most browsers (like Cgrome or Edge) usedthe same browsing engine, an open-source code called Chromium. And that engine lets a browser-only app like Logo access Bluetooth devices.

The most notable browsers that do not use the Chromium engine are Apple’s Safari and Firefox; both do not offer Bluetooth connectivity. Also, most tablet browsers support Bluetooth; unfortunately, the Safari browser on iPads doesn’t.

On startup, Logo checks if the browser supports BLuetooth, and if your computerhas an active Bluetooth radio. If so, Logo’s icon bar contains the Bluetooth icon above.

Unfortunately, Logo does not support serial cables; it cannot connect to a Pro-Bot.

Select a Bluetooth Robot

Please click the Bluetooth button in the icon bar. Your browser displays a selection dialog that is populated over time with Logo-compatible Bluetooth devices that the browser has found. Select the device that you’d like to connect to. A Blue-Bot should, for example, turn blue, and an InO-Bot should beep and flash its lights when connected.

Again, make sure that your robots are turned on!

If you connect to an InO-Bot, Logo creates a special turtle that looks like that robot, and that is connected to your robot. Logo also sets the TELL list to that turtle so you can start issuing commands like FORWARD or RIGHT right away, and both the screen turtle and the robot will move! To disconnect, ERASE your turtle. Please read the InO-Bot chapter for a detailed list of features.

Bluetooth Troubleshooting

On some computers, it is difficult to connect to a robot. If you experience problems, try the following:

  • Make sure that you have paired your robot with your computer. Also make sure that your robot has been paired as a headset device. This sounds strange, but your robot disguises itself as a headset device.
  • Turn Bluetooth off and on again.
  • Go to the Bluetooth Settings dialog of your operating system, remove the robot, and try to re-pair it.
  • Make sure that your robot is not too close to a USB 3 device; USB 3 may emit pulses that could disrupt Bluetooth transmissions.

Blue-Bot and Tuff-Bot Commands

The Blue-Bot

The Blue-Bot is much like an intelligent version of the famous Bee-Bot; it can talk Bluetooth, however. When a connection to Blue-Bot has succeeded, the Blue-Bot turns blue. Now, you can transmit Logo commands to BLue-Bot, and it will execute these commands.

The first command that you should enter is BLUEBOT?. It returns TRUE if Logo finds your Blue-Bot, or FALSE if it does not. You may want to use this command within your Logo program, and stop running if BLUEBOT? returns FALSE.

When you try to push one of Blue-Bot’s buttons while it is connected, you will notice that the buttons do not work anymore. Blue-Bot can only listen to a single source of commands: it is either the buttons or the computer, but not both. Therefore, Logo has two commands for two important buttons:

BLUEBOT.GO acts as if you pressed the GO button, and BLUEBOT.CLEAR clears Blue-Bot’s memory as its CLEAR button would.

A more important command is the BLUEBOT.RUN command. It takes a list of commands, downloads it to Blue-Bot and runs it. Alternatively, it also accepts a procedure name, and downloads the contents of that procedure.

The BLUEBOT.WRITE command also downloads a command list or procedure, but it does not run it afterwards. You need to issue the BLUEBOT.GO command afterwards. This is handy if you want to execute the same sequence of commands over and over again.

Blue-Bot’s knowledge of Logo commands is very limited, and its memory is limited to 200 commands. Please note that a Logo command may produce 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, might store 10 FD commands into Blue-Bot’s memory.

For a complete list of Blue-Bot commands, please see the BLUEBOT.RUN command.

Here’s an example. Guess what it does!

The Tuff-Bot

Tuff-Bot is Blue-Bot’s big brother. It is way more rugged, and it can even avoid obstacles. When a connection to Tuff-Bot has succeeded, the Tuff-Bot turns blue.

Tuff-Bot has the same commans as Blue-Bot, but they all begin with TUFFBOT instead of BLUEBOT. So if you want to check if a Tuff-Bot is connected, you use the command TUFFBOT? instead of BLUEBOT?, and if you want to run commands, use TUFFBOT.RUN instead of BLUEBOT.RUN.

Tuff-Bot has two buttons. The left button enables obstacle detection, and the right button sets the speed mode. The TUFFBOT.BUTTONS command programs these buttons.

Also, you can define what Tuff-Bot should do when it detects an obstacle. The default is:

  • back up one step
  • turn right 90 degrees
  • forward one step
  • turn left 90 degrees

With the TUFFBOT.OBSTACLE command, you can define another procedure that Tuff-Bot runs when it detects an obstacle. You should keep this procedure short, however.

Simulate a Robot

A bot is just a floor turtle, so why not use a turtle on-screen as a bot? Just give it the shape of a robot, like

And you have the bot on screen. Of course, moving the turtle by one unit does not really move it, because a turtle unit is a single pixel. Therefore, you can change the number of pixels that the turtle advances by changing the turtle’s STEPSIZE property. This property is the factor that a forward or backwards movement is multiplied with. Usually, this factor is 1, but you can change that factor to any value you like. The command PPROP 0 “STEPSIZE 25, for example, makes turtle #0 move 25 pixels for each FORWARD or BACK unit.

For Blue-Bots, its natural step size is about the size of the bot, which is 15 centimeters for Blue-Bot. For a realistic movement, you would need to do the following:

  1. LOADSHAPE your turtle to the desired shape (or drag and drop the shape from the Toolbox, but please note that such a turtle is actually a BITMAP, which means that it cannot draw).
  2. Determine its size by examining the turtle’s SIZE property.
  3. Set the turtle’s STEPSIZE property to the shape’s height.
  4. Optionally alter the turtle’s CRAWL property to make it move slower on the screen.

This procedure would do all this for you: