LEGO NXT specific blocks
This article is automatically translated from Russian by Google Translator.
Specialized blocks for LEGO NXT are divided into several categories:
Action — blocks that perform some action on the robot: turn on motors, play sound, etc.
Waiting — units waiting for some event to occur: certain sensor readings, button presses, etc.
Drawings on the display — blocks used to display graphics and text on the screen
For the blocks available for all platforms, see the article
Common blocksAction blocks
Icon | Name | Description |
Play a fixed-frequency sound on the robot. | ||
Play the sound on the robot at a given frequency and duration. | ||
Turn on the motors on the set ports with the set power. | ||
Turn on the motors in reversing mode on the set ports with the set power. | ||
Turn off the motors on the specified ports. | ||
Reset the number of motor revolutions. |
Beep
Play a fixed-frequency sound on the robot. Parameters:
Whether to wait for the sound to end or go straight to the next block. Valid values are true, false.
Playback volume (0 to 100%).
Play Tone
Play a sound on the robot with the set frequency and duration. Similar to the "Horn" block, but also allows you to set the sound parameters. Parameters:
Frequency (Hz).
Duration (ms).
Whether to wait for the sound to end or go to the next block immediately. Valid values - true, false.
Playback volume (from 0 to 100%).
Motors Forward
Turn on the motors on the set ports with the set power. The ports are specified by the letters A, B, or C, separated by commas.
The power is set as a percentage from -100 to 100. If a negative value is set, the motor is reversed.
The motors have different modes of operation: braking mode and sliding mode (indicated by a red or green rectangle on the block, respectively). The modes affect the way the motor responds to a command - braking mode stops the motor when shut down, the sliding mode allows the motor to crank through its inertia.
Motors Backward
Turn on the motors in reversing mode on the set ports with the set power.
Parameters are similar to the parameters of the "Motors forward" block.
Stop Motors
Turn off the motors on the specified ports.
Clear Encoder
Reset the number of motor revolutions.
Waiting Blocks
Icon | Name | Description |
Wait for the touch sensor to work. | ||
Wait until the distance returned by the ultrasonic distance sensor is comparable to that specified in the Distance parameter value. | ||
Wait for the color sensor in color recognition mode to return the specified color. | ||
Wait until the RPM counter reading on the specified motor reaches the RPM Limit value specified in the "RPM Limit" parameter value. | ||
Wait until the value returned by the color sensor on the specified port is comparable to the value specified in the Intensity parameter. | ||
Wait until the value returned by the light sensor on the specified port is comparable to the value specified in the Percentage parameter. | ||
Wait until the volume read by the microphone on the specified port is above or below the set value. | ||
Wait for the button on the robot body to be pressed. |
Wait for Touch Sensor
Wait for the touch sensor to work.
The parameter specifies the number of the port to which the sensor is connected. Valid values: 1, 2, 3, 4.
Wait for Sonar Distance
Wait until the distance returned by the ultrasonic distance sensor is comparable to that specified in the Distance parameter value. Parameters:
Distance (in centimeters, from 0 to 255).
Port - number of the port to which the distance sensor is connected.
Read value - the operation that will be used for comparison with the entered distance.
Wait for Color
Wait for the color sensor in color recognition mode to return the specified color.
Parameters:
Color.
Port - the number of the port to which the color sensor is connected.
Wait for Encoder
Wait until the RPM counter reading on the specified motor reaches the RPM Limit value specified in the "RPM Limit" parameter value.
Parameters:
Port - the name of the port to which the motor is connected (A, B, or C).
Read value - the operation that will be used for comparison with the entered RPM limit.
RPM limit.
Wait for Color Intensity
Wait until the value returned by the color sensor on the specified port is comparable to the value specified in the Intensity parameter.
Parameters:
Intensity (0 to 100%).
Port - number of the port to which the color sensor is connected.
Read value - the operation that will be used to compare with the entered intensity.
Wait for Color
Wait until the value returned by the light sensor on the specified port is comparable to the value specified in the Percentage parameter.
Parameters:
Percentages (from 0 to 100%).
Port - the number of the port to which the color sensor is connected.
Read value - the operation that will be used to compare with the Percent value.
Wait for Sound Sensor
Wait until the volume read by the microphone on the specified port is above or below the set value.
Wait for Button
Wait for the button on the robot body to be pressed.
Drawing on the display
Icon | Name | Description |
Prints the specified line at the specified location on the robot's screen. | ||
Erase everything that is drawn on the screen. | ||
Draw a rectangle on the screen. | ||
Draw a point on the screen at the specified coordinates. | ||
Draw a segment on the screen. | ||
Draw a circle on the screen with a given center and a given radius. |
Print Text
Prints the specified line at the specified location on the robot's screen.
The default value of the Text property is treated as a pure string, and it will be displayed that way. To make the system assume that this is a textual expression (which can be useful, for example, when debugging variable values), check the "Compute" checkbox in the Property Editor.
Clear Screen
Erase everything that is drawn on the screen.
Draw Rectangle
Draw a rectangle on the screen.
Parameters:
X, Y - coordinates of the upper left corner.
The width of the rectangle.
The height of the rectangle.
Update the picture (true or false).
Draw Pixel
Draw a point on the screen at the specified coordinates.
Draw Line
Draw a segment on the screen.
Parameters:
X1, Y1 - coordinates of the beginning of the segment.
X2, Y2 - coordinates of the end of the segment.
Update the picture (true or false).
Draw Circle
Draw a circle on the screen with a given center and a given radius.
Parameters:
X, Y - coordinates of the center of the circle.
The radius of the circle.
Update the picture (true or false).
Last updated