User Tools

Site Tools


weblogo:commands:robots

Robot Commands

All Buetooth 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 that the Web based version of Logo cannot offer. To use Pro-Bot, you need to use the desktop version of Terrapin Logo.

Please note that robot commands are only available in the licensed version of Logo.

BLUEBOT? (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.

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.

Root: The Root robot's LEDs are only accessible as a single LED. Therefore, the first input controls the effect: 0 is off, 1 is on, 2 blinks the LEDs, and 3 spins the LEDs.

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

PROBOT? reports TRUE if a Pro-Bot is connected to your computer; if Logo cannot find a Pro-Bot, PROBOT? reports FALSE.

Example

PROBOT?
Result: FALSE

PROBOT.CLOSE

Disconnects the Pro-Bot from Logo.

Syntax

PROBOT.CLOSE

Description

PROBOT.CLOSE closes the connection to Pro-Bot.

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. On the Pro-Bot, it turns its headlights on or off. The Logo command tries to turn on the headlights by looking for a turtle named PROBOT. If there us such a turtle, it attempts to set the turtle's shape to either ~HOME/TOOLBOX/ROBOTS/PROBOTLIGHTS.PNG or PROBOT.PNG.

DECLARE "TURTLE "PROBOT
PROBOT.LIGHTS TRUE
ProBot lights are ON

PROBOT.READ

Uploads all Pro-Bot procedures into Logo's workspace.

Syntax

PROBOT.READ

Description

PROBOT.READ uploads all procedures stored in the Pro-Bot into the Logo workspace. It displays the name of every defined procedure and reports the movement units that the Pro-Bot is configured to; this is either CM or BOT, where the latter movement unit is about 25 centimeters.

PROBOT.READ uses the following procedure names when creating the Logo procedures.

PROBOT.MAIN This is the main program.
PROC1 through PROC32 The Pro-Bot can store up two 32 different procedures; these procedures must be named exactly this way.
ON.FRONT The name of the procedure that the Pro-Bot runs if the front sensor is triggered.
ON.REAR The name of the procedure that the Pro-Bot runs if the rear sensor is triggered.
ON.LIGHT The name of the procedure that the Pro-Bot runs if the light sensor reports a brightness level of more than about 50 Lux.
ON.DARK The name of the procedure that the Pro-Bot runs if the light sensor reports a brightness level dropping below 50 Lux.
ON.SOUND The name of the procedure that the Pro-Bot runs if the sound sensor registers a sharp sound like the clapping of hands. Note that the sound sensor is only enabled if the motors do not run; you should use the Pro-Bot's Pause command to make it wait for a sound.

Note that the Pro-Bot does not check its sensors if a main program is not running. To make Pro-Bot check its sensors, have it run a procedure, or WAIT for anything to happen.

Example

PROBOT.READ
PROBOT.MAIN defined
PROC1 defined
PROC2 defined
ON.FRONT defined
Result: CM

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

PROBOT.WRITE downloads all Pro-Bot procedures to the Pro-Bot. Note that the procedure names must match the names listed under the PROBOT.READ command. Optionally, PROBOT.WRITE takes the movement units that the Pro-Bot should be configured to; this is either CM or BOT, where the latter movement unit is about 25 centimeters. As backwards compatibility, you can also use the word PROBOT instead of BOT.

Example

PROBOT.WRITE

ROOTBOT? (ROOTBOTP)

Tests if a Root robot is connected and ready to receive commands.

Syntax

ROOTBOT?

Description

ROOTBOT? reports TRUE if Logo can talk to a Root robot.

Example

ROOTBOT?
Result: FALSE

ROOTBOT.CLOSE

Disconnects a Root robot.

Syntax

ROOTBOT.CLOSE

Description

ROOTBOT.CLOSE disconnects a Root robot from Logo and erases the screen turtle. This is a synonym for the command ERASErobot-name.

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]
weblogo/commands/robots.txt · Last modified: 2019/01/22 06:09 (external edit)