Pro-Bot and Blue-Bot Commands
Are you a proud owner of a Pro-Bot, a Blue-Bot, or an InO-Bot? Have you ever dreamed of programming these cute little bots with Logo? Then this chapter is for you! All others, please read on.
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.
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, Weblogo 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 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, might store 10 FD commands into Blue-Bot’s
For a complete list of Blue-Bot commands, please see the BLUEBOT.RUN command.
Here’s an example. Guess what it does!
BLUEBOT.RUN [FORWARD 1 LEFT 45 FORWARD 1 LEFT 135 FORWARD 1 LEFT 45 FORWARD 1]
The Pro-Bot is a bit more complex than Blue-Bot. It understands more commands, and it can turn more accurately in degrees instead of 45-degree increments, as Blue-Bot does. It can keep up to 32 user-defined procedures in addition to its main program, plus a set of procedures that Pro-Bot invokes when its sensors are triggered.
You can use the PROBOT? command to check if a Pro-Bot is connected. Since Pro-Bot is connected via a USB cable, there is no need to try to connect via Bluetooth.
To program Pro-Bot, you define a set of Logo procedures with special
names. You would define Pro-Bot’s main procedure as the procedure
PROBOT.MAIN, while you would name procedures 1 through 32 as
PROC32. Using these names is important, because
PROBOT.WRITE cannot pick up the
procedures if they are named incorrectly!
All procedures that Pro-Bot calls when a sensor is activated begin with
ON.. For the front and rear bumpers, we have
When the light sensor sees the ambient light drop below a certain level,
ON.DARK, and if the ambient light is above a certain
level, it invokes
ON.LIGHT. Finally, Pro-Bot calls
ON.SOUND if its
built-in microphone registers a sound like the clapping of hands.
Please note that these names are Logo names. The procedure names on Pro-Bot itself are named similarly; you can see and edit them if you press Pro-Bot’s “Menu” button, and then select “Edt Proc”.
When you press Pro-Bot’s “Go” button, it runs its main procedure, which
can call all other procedures in turn. One more word about Pro-Bot’s
sensor procedures. Pro-Bot calls these procedures only if its main
procedure is running. If Pro-Bot does not run a procedure, you can, for
example, bump against its front bumper as much as you want; nothing
happens. So, usually, Pro-Bot would execute a movement command like
“FORWARD 499”, which makes it run forward for a long time. If it runs
against an obstacle during this movement, it would run its
This is a very simple example. It lets Pro-Bot run, and if it runs into, say, a chair, it would back up a unit, and turn left 90 degrees.
TO PROBOT.MAIN FORWARD 499 END TO ON.FRONT BACK 1 LEFT 90 END
A warning about
ON.SOUND. Because the sound of Pro-Bot’s motors would
disturb its microphone, Pro-Bot activates it only if the motors are not
turned on. You can use this to start Pro-Bot when you clap your hands,
but you need to have Pro-Bot execute its main program. The WAIT command
is just right for this purpose. In this example, Pro-Bot waits for ten
seconds and then stops executing. When you clap your hands, Pro-Bot
moves forward one unit and beeps:
TO PROBOT.MAIN WAIT 10000 END TO ON.SOUND FORWARD 1 PROBOT.SOUND 6 END
Logo has two commands to transfer Pro-Bot procedures to your computer
and back. PROBOT.READ reads all of
Pro-Bot’s procedures and defines them in Logo. You will notice a few
extra procedures, like
DIAMND. These are read-only procedures that
Pro-Bot has stored as sample procedures. To send all Logo procedures
with the names mentioned above down to Pro-Bot, use
A final word about Pro-Bot units. Usually, one Pro-Bot step is about 25
centimeters (or 10 inches). You can, however, switch this unit to
centimeters, where one step is a single centimeter.
PROBOT.READ outputs the current
measurement unit, which is either
PROBOT.WRITE takes an extra, optional
input to switch the units to either
PROBOT.LIGHTS actually works for a
turtle! Just create a turtle named
PROBOT, and use the command to
turn on its lights!
DECLARE "TURTLE "PROBOT PROBOT.LIGHTS TRUE
And PROBOT.SOUND actually plays the original Pro-Bot sounds!
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.
PPROP 0 “STEPSIZE 25, for example, makes turtle #0 move
25 pixels for each FORWARD or
For Pro-Bots and Blue-Bots, its natural step size is about the size of the bot, which is 25 centimeters for Pro-Bot and 15 centimeters for Blue-Bot. For a realistic movement, you would need to do the following:
- 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).
- Determine its size by examining the turtle’s
- Set the turtle’s
STEPSIZEproperty to the shape’s height.
- Optionally alter the turtle’s
CRAWLproperty to make it move slower on the screen.
This procedure would do all this for you:
TO MAKE.ROBOT :TURTLE :ROBOT ASK :TURTLE [LOADSHAPE WORD "~HOME/TOOLBOX/ROBOTS/ :ROBOT] ; set the step size PPROP :TURTLE "STEPSIZE LAST GPROP :TURTLE "SIZE ; have it slow down for realistic movement PPROP :TURTLE "CRAWL 0.5 END