Robot Commands
All Bluetooth robots must be connected to Logo with the Bluetooth selection dialog available at the “Tools/Connect to Bluetooth Device” menu item or the SELECT.BLUETOOTH command.
Pro-Bot needs a serial-to-USB connection, which Terrapin Logo is unable to support at the time.
BLUEBOT?
Also: BLUEBOTP, BLUEBOT.OPEN
Tests if the Blue-Bot is connected and ready to receive commands.
Syntax
BLUEBOT?
Description
BLUEBOT? reports TRUE
if it can talk to a Blue-Bot.
For backwards compatibility, BLUEBOT.OPEN is synonymous to BLUEBOT?.
Example
BLUEBOT? Result: FALSE
BLUEBOT.BATTERY
Reports Blue-Bot’s battery level.
Syntax
BLUEBOT.BATTERY
Description
BLUEBOT.BATTERY reports Blue-Bot’s battery level, which is a number between 0 and 1. It may take a few seconds before Blue-Bot actually reports the battery level; the command would report 0 in that case.
Example
BLUEBOT.BATTERY Result: 0.8
BLUEBOT.CLEAR
Clears all commands stored in Blue-Bot’s memory.
Syntax
BLUEBOT.CLEAR
Description
BLUEBOT.CLEAR clears all commands stored in a Blue-Bot. This is equivalent to pressing Blue-Bot’s CLEAR button, which is disabled when Blue-Bot is connected.
BLUEBOT.CLOSE
Disconnects the Blue-Bot from Logo.
Syntax
BLUEBOT.CLOSE
Description
BLUEBOT.CLOSE closes the connection to Blue-Bot. After a while, Blue-Bot turns off the blue lights, indicating that it is available for a new connection; it also turns its buttons back on.
BLUEBOT.GO
Executes commands stored in Blue-Bot’s memory.
Syntax
BLUEBOT.GO
Description
BLUEBOT.GO executes all commands that a previous BLUEBOT.WRITE command has stored into Blue-Bot. This is equivalent to pressing Blue-Bot’s GO button, which is disabled when Blue-Bot is connected.
BLUEBOT.RUN
Executes Blue-Bot commands.
Syntax
BLUEBOT.RUN procedurename
BLUEBOT.RUN [list of commands]
Description
BLUEBOT.RUN transmits a list of commands to Blue-Bot and lets Blue-Bot execute them immediately. Use the BLUEBOT.WRITE and BLUEBOT.GO commands if you want Blue-Bot to repeatedly execute a list of stored commands.
If you call BLUEBOT.RUN with a procedure name, BLUEBOT.RUN downloads the contents of the procedure to Blue-Bot. Note that the use of variables like procedure inputs is not permitted.
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.
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. 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. Logo rounds wait times 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. |
FLASH | This Blue-Bot-only command flashes Blue-Bot’s eyes. |
Example
BLUEBOT.RUN [REPEAT 4 [FD 1 RT 90]]
BLUEBOT.WRITE
Downloads a procedure to Blue-Bot.
Syntax
BLUEBOT.WRITE procedure-name
BLUEBOT.WRITE [runlist]
Description
BLUEBOT.WRITE transmits a procedure to Blue-Bot. Its input is the name of the procedure to transmit. It does not run these commands; use the BLUEBOT.GO command to execute a stored list of commands.
Example
TO MY.BLUEBOT REPEAT 4 [FD 1 RT 90] END MY.BLUEBOT defined BLUEBOT.WRITE “MY.BLUEBOT BLUEBOT.GO
LED
Controls a robot’s LEDs.
Syntax
LED word-or-list color
(LED word-or-list color duration)
Description
LED controls the LEDs of a robot. Depending on the robot type, its first inputs can be a word or a list. The second input is a color name or color value.
If a third input is given, it is the duration in milliseconds that each of the LEDs should be turned on. Note that not all LEDs are turned on at the same time, but one after another, staying on for the given time. This allows for interesting light effects.
InO-Bot: InO-Bot has eight full-color LEDs. The first input is either a number from 1 to 8, or a list containing the numbers of the LEDs to set. The second input is a color name or a color value.
Example
; InO-Bot example ; set LED #1 to red LED 1 “RED ; set LEDs 2, 3, and 4 to gold for half a second each (LED [2 3 4] “GOLD 500) ; turn all LEDs off LED [1 2 3 4 5 6 7 8] “BLACK
MOTORS
Controls a robot’s motors.
Syntax
MOTORS speed
Description
MOTORS controls the speed or a robot’s motors. It input is a value or a list of values between -1 and 1. The value 0 causes the motor to stop, and the value 1 turns on the motors at full speed. Positive values causes the motor to move forward, while negative values cause the motor to move backwards.
Currently, all floor robots accept a single number that controls the speed of all motors. Use MOTORS 0 to stop the motors.
Example
MOTORS 0.5 WAIT 1000 MOTORS 0
PROBOT? (PROBOTP, PROBOT.OPEN)
Tests if a Pro-Bot is connected and ready to receive commands.
For backwards compatibility, PROBOT.OPEN is synonymous to PROBOT?.
Syntax
PROBOT?
Description
This command will display a dialog stating that Terrapin Logo cannot support Pro-Bot. This may change in a future version of Logo.
PROBOT? reports FALSE
.
Example
PROBOT? Result: FALSE
PROBOT.CLOSE
Disconnects the Pro-Bot from Logo.
Syntax
PROBOT.CLOSE
Description
PROBOT.CLOSE does not have any effect.
PROBOT.LIGHTS
Turns the Pro-Bot’s headlights on or off.
Syntax
PROBOT.LIGHTS TRUE or FALSE
Description
PROBOT.LIGHTS is a
placeholder command for the Pro-Bot. Logo sets the turtle’s shape to either
~HOME/TOOLBOX/ROBOTS/PROBOTLIGHTS.PNG
or PROBOT.PNG
.
PROBOT.LIGHTS TRUE
PROBOT.READ
Uploads all Pro-Bot procedures into Logo’s workspace.
Syntax
PROBOT.READ
Description
This command will display a dialog stating that Terrapin Logo cannot support Pro-Bot. This may change in a future version of Logo.
PROBOT.SOUND
Plays Pro-Bot sounds.
Syntax
PROBOT.SOUND 1 through 7
Description
PROBOT.SOUND plays one of the seven Pro-Bot sounds by playing one of the
sound files at ~home/Sounds/Probot1.wav
to Probot7.wav
. It is a
placeholder for the Pro-Bot’s Sound
command.
Example
PROBOT.SOUND 3
PROBOT.WRITE
Downloads all Pro-Bot procedures to the Pro-Bot.
Syntax
PROBOT.WRITE
(PROBOT.WRITE units)
Description
This command will display a dialog stating that Terrapin Logo cannot support Pro-Bot. This may change in a future version of Logo.
Example
PROBOT.WRITE
SELECT.BLUETOOTH
Selects a Bluetooth device.
Syntax
SELECT.BLUETOOTH
Description
SELECT.BLUETOOTH opens the Bluetooth selection dialog and lets the user select a Bluetooth device. Its output is a two-element list. The first element is the device type, like e.g. BLUEBOT or INOBOT, and the second element is the Logo name of the device. This may be different from the first element if the user has renamed the Bluetooth device. If the user canceled the dialog, SELECT.BLUETOOTH outputs an empty list. On errors, SELECT.BLUETOOTH throws a runtime error which can be caught with the CATCH command.
SELECT.BLUETOOTH must be used in response to a user action, like clicking a button. Browser environments demand this functionality.
Example
SELECT.BLUETOOTH Result: [BLUEBOT BETTY]
TUFFBOT?
Also: TUFFBOTP, TUFFBOT.OPEN
Tests if the Tuff-Bot is connected and ready to receive commands.
Syntax
TUFFBOT?
Description
TUFFBOT? reports TRUE
if Logo can talk to a Tuff-Bot.
For backwards compatibility, TUFFBOT.OPEN is synonymous to TUFFBOT?.
Example
TUFFBOT? Result: FALSE
TUFFBOT.BATTERY
Reports Tuff-Bot’s battery level.
Syntax
TUFFBOT.BATTERY
Description
TUFFBOT.BATTERY reports Tuff-Bot’s battery level, which is a number between 0 and 1. It may take a few seconds before Tuff-Bot actually reports the battery level; the command would report 0 in that case.
Example
TUFFBOT.BATTERY Result: 0.8
TUFFBOT.BUTTONS
Programs Tuff-Bot’s buttons.
Syntax
TUFFBOT.BUTTONS obstacle speed
Description
TUFFBOT.BUTTONS programs Tuff-Bot’s obstacle avoidance and speed buttons. The first input is either TRUE or FALSE, and turns obstacle detection on or off. The second input is a value between 0 and 2, which indicates how many times Tuff-Bot’s speed button is pressed:
- 0: Tuff-Bot stops between each command.
- 1: Tuff-Bot executes all commands in a single, flowing motion.
- 2: In addition to 1, Tuff-Bot makes quicker turns.
Example
TUFFBOT.BUTTONS TRUE 1
TUFFBOT.CLEAR
Clears all commands stored in Tuff-Bot’s memory.
Syntax
TUFFBOT.CLEAR
Description
TUFFBOT.CLEAR clears all commands stored in a Tuff-Bot. This is equivalent to pressing Tuff-Bot’s CLEAR button, which is disabled when Tuff-Bot is connected. Note that Tuff-Bot’s obstacle avoidance subroutine cannot be cleared.
TUFFBOT.CLOSE
Disconnects the Tuff-Bot from Logo.
Syntax
TUFFBOT.CLOSE
Description
TUFFBOT.CLOSE closes the connection to Tuff-Bot. After a while, Tuff-Bot turns off the blue lights, indicating that it is available for a new connection; it also turns its buttons back on.
TUFFBOT.GO
Executes commands stored in Tuff-Bot’s memory.
Syntax
TUFFBOT.GO
Description
TUFFBOT.GO executes all commands that a previous TUFFBOT.WRITE command has stored into Tuff-Bot. This is equivalent to pressing Tuff-Bot’s GO button, which is disabled when Tuff-Bot is connected.
TUFFBOT.OBSTACLE
Downloads an obstacle avoidance routine to Tuff-Bot.
Syntax
TUFFBOT.OBSTACLE procedure-name
TUFFBOT.OBSTACLE [runlist]
Description
TUFFBOT.OBSTACLE downloads an obstacle-avoidance subroutine to Tuff-Bot. This subroutine takes the same commands as the TUFFBOT.WRITE command. The subroutine should be short, and back up Tuff-Bot, and turin it into a different direction.
Example
TUFFBOT.OBSTACLE [BACK 1 RT 45]
TUFFBOT.RUN
Executes Tuff-Bot commands.
Syntax
TUFFBOT.RUN procedurename
TUFFBOT.RUN [list of commands]
Description
TUFFBOT.RUN transmits a list of commands to Tuff-Bot and lets Tuff-Bot execute them immediately. Use the TUFFBOT.WRITE and TUFFBOT.GO commands if you want Tuff-Bot to repeatedly execute a list of stored commands.
If you call TUFFBOT.RUN with a procedure name, TUFFBOT.RUN downloads the contents of the procedure to Tuff-Bot. Note that the use of variables like procedure inputs is not permitted.
Tuff-Bot stores a maximum of up to 200 commands. Please note that a Logo
command may consume more than one Tuff-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 Tuff-Bot’s memory.
The following table provides an overview over all available Logo commands that Tuff-Bot understands.
FORWARD | Tuff-Bot moves forward in fixed-size units. A value of 1 does not mean a single pixel as the screen turtle, but one Tuff-Bot movement unit, which is about 6 inches (15 cm). If you, for example, use the command FD 2 , Tuff-Bot will move forward one unit, stop briefly, and then move forward a second unit. |
BACK | As with the FORWARD command, Tuff-Bot moves backwards in the same way that it moves forward. If you use negative values as input to BACK , Tuff-Bot moves forward and vice versa. |
LEFT | Tuff-Bot turns left or right in 45-degree increments. Logo calculates the amount to turn in as few commands as possible. Therefore, Tuff-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 Tuff-Bot turn in the opposite direction. |
WAIT | This command corresponds to Tuff-Bot’s Pause button. Tuff-Bot pauses in units of about two seconds. Therefore, the input to WAIT (which is a millisecond value) should be a multiple of 2000. Logo rounds wait times to the nearest multiple of two seconds. |
REPEAT | Tuff-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. |
Example
TUFFBOT.RUN [REPEAT 4 [FD 1 RT 90]]
TUFFBOT.WRITE
Downloads a procedure to Tuff-Bot.
Syntax
TUFFBOT.WRITE procedure-name
TUFFBOT.WRITE [runlist]
Description
TUFFBOT.WRITE transmits a procedure to Tuff-Bot. Its input is the name of the procedure to transmit. It does not run these commands; use the TUFFBOT.GO command to execute a stored list of commands.
Example
TO MY.TUFFBOT REPEAT 4 [FD 1 RT 90] END MY.TUFFBOT defined TUFFBOT.WRITE “MY.TUFFBOT TUFFBOT.GO