Robot Commands
All Bluetooth robots must be connected to Logo with the Bluetooth selection dialog available at the Bluetooth icon or the SELECT.BLUETOOTH command.
BLUEBOT.BATTERY
Reports Blue-Bot’s battery level; no inputs.
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.
Examples
BLUEBOT.BATTERY Result: 0.8
BLUEBOT.CLEAR
Clears all commands stored in Blue-Bot’s memory; no inputs.
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; no inputs.
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; no inputs.
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; one input.
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 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.
Command | Description |
---|---|
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. |
Examples
BLUEBOT.RUN [REPEAT 4 [FD 1 RT 90]]
BLUEBOT.WRITE
Downloads a procedure to Blue-Bot; one input.
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.
Examples
TO MY.BLUEBOT REPEAT 4 [FD 1 RT 90] END Result: MY.BLUEBOT defined BLUEBOT.WRITE “MY.BLUEBOT BLUEBOT.GO
BLUEBOT?
Also: BLUEBOTP, BLUEBOT.OPEN
Tests if the Blue-Bot is connected and ready to receive commands; no inputs.
Syntax
BLUEBOT?
Description
BLUEBOT? reports TRUE if it can talk to a Blue-Bot.
For backwards compatibility, BLUEBOT.OPEN is synonymous to BLUEBOT?.
Examples
BLUEBOT? Result: FALSE
INOBOT.CLOSE
Closes the connection to an InO-Bot; no inputs.
Syntax
Description
INOBOT.CLOSE closes the connection to a connected InO-Bot. After a while, the InO-Bot turns off the blue lights, indicating that it is available for a new connection; it also turns its buttons back on.
INOBOT?
Also: INOBOTP
Tests if an InO-Bot is connected and ready to receive commands; no inputs.
Syntax
INOBOT?
Description
INOBOT? reports TRUE if Logo can talk to a InO-Bot.
Examples
INOBOT? Result: FALSE
LED
Controls a robot’s LEDs; expects between two inputs and three inputs, but parentheses are needed if not called with two inputs.
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 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.
Currently, InO-Bot is the only bot that has controllable LEDs. This may change in the future.
Examples
; 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; one input.
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.
Examples
MOTORS 0.5 WAIT 1000 MOTORS 0
SELECT.BLUETOOTH
Selects a Bluetooth device; no inputs.
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. You can also click the BLuetooth icon in the icon bar.
After selecting a Blue-Bot, InO-Bot, or a Tuff-Bot, you can use the robot’s commands to control the robot, like for example BLUEBOT.RUN.
Examples
SELECT.BLUETOOTH Result: [BLUEBOT BETTY]
TUFFBOT.BATTERY
Reports Tuff-Bot’s battery level; no inputs.
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.
Examples
TUFFBOT.BATTERY Result: 0.8
TUFFBOT.BUTTONS
Programs Tuff-Bot’s buttons; two inputs.
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.
Examples
TUFFBOT.BUTTONS TRUE 1
TUFFBOT.CLEAR
Clears all commands stored in Tuff-Bot’s memory; no inputs.
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; no inputs.
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; no inputs.
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; one input.
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 turning it into a different direction.
Examples
TUFFBOT.OBSTACLE [BACK 1 RT 45]
TUFFBOT.RUN
Executes Tuff-Bot commands; one input.
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 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.
Command | Description |
---|---|
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. |
Examples
TUFFBOT.RUN [REPEAT 4 [FD 1 RT 90]]
TUFFBOT.WRITE
Downloads a procedure to Tuff-Bot; one input.
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.
Examples
TO MY.TUFFBOT REPEAT 4 [FD 1 RT 90] END Result: MY.TUFFBOT defined TUFFBOT.WRITE “MY.TUFFBOT TUFFBOT.GO
TUFFBOT?
Also: TUFFBOTP, TUFFBOT.OPEN
Tests if the Tuff-Bot is connected and ready to receive commands; no inputs.
Syntax
TUFFBOT?
Description
TUFFBOT? reports TRUE if Logo can talk to a Tuff-Bot.
For backwards compatibility, TUFFBOT.OPEN is synonymous to TUFFBOT?.
Examples
TUFFBOT? Result: FALSE