»Program start«

Each program starts with the red »Program start« block.

This block is always available in the Open Roberta Lab and cannot be deleted. The little triangle below the start block is called »sequence connector«. The first block you want to use will be connected by using the »sequence connector« at the start block. The sequence connector color changes to yellow when a suitable block comes into its range.

Settings:


If global variables have been created:

»motor port ... on«

With the »motor port ... on« block you can program the speed (velocity) of the selected motor. Your robot starts the selected motor, until it is stopped or another block specifies new moving parameters.

Options and Arguments:

»motor port ... on ... for«

With the »motor port ... rotation« block you can program the speed (velocity) of the selected motor. Your robot starts the selected motor and rotates the motor until the specified number of rotations or degrees is done.

Options and Arguments:

»get speed motor port«

The block »get speed motor port « reads the speed (velocity) of the selected motor. The motor can have a speed from -100 (rotating backwards) to 100.

Options and Arguments:


Return value:

»set motor port speed«

The block »set motor port ... speed« sets the speed (velocity) of one selected motor to a new value.

Options and Arguments:

»stop motor port«

Using the block »stop motor port « switches off one selected motor. You can decide the motor to run out slowly (float) or to break immediately

Setting options:

»drive«

With the »drive« block you can program the direction and also the speed (velocity) of your robot. Your robot moves until it is stopped or another block specifies new driving parameters. The driving speed can be set in the field »speed«.

Options and Arguments:

»drive distance«

With the »drive distance« block you can program the direction and the speed of the robot. The speed of your robot is set in the »speed« parameter. Once the block has been executed the motors stop automatically.

»drive distance« controls both motors of the robot at the same time, meaning that the settings you make here apply to both motors of the robot. If the robot's actions don't correspond with the block's settings when running the program, check the robot configuration settings, especially the wheel diameter and the track width.

Settings and input values:

»stop«

The »stop« block stops the motors immediately.

Settings: none

»turn«

With the »turn« block you set the direction (right/left) which the robot will turn. Your robot turns until it is stopped or another block is used for driving. You can set the speed in the block parameter field »speed«.

»turn« controls both motors of the robot at the same time, therefore the robot turns on the spot. If the EV3 Robot's actions don't correspond with the block's settings when running the program, check the EV3 robot configuration settings, especially the wheel diameter and the track width.

Settings and input values:

If your robot turns into the wrong direction, then the motors are connected to the wrong ports. Just swap the ports and your robot will turn into the right way.

»turn degree«

With the »turn degree« block you program the direction (right/left) that your robot will turn. In addition to the direction you can also program the »degrees«, allowing you to program how many degrees your robot should rotate (around its axis). This means that you do a complete rotation by setting a 360 degree turn..

The »turn degree« block controls both motors of the robot in such a way that the robot turns around its own axis. If the robot's actions don't correspond with the block's settings when running the program, check the EV3 robot configuration settings, especially the wheel diameter and the track width.

Settings and input values:

»steer ... speed left ... speed right ...«

The block »steer ... speed left ... speed right ...« programs the robot to drive a curve by setting different speeds for the left and right motor. The robot configuration influences the radius of the curve depending from wheel distance and wheel diameter. The turning direction will define the driving direction.

Settings and input values:


»steer ... speed left ... speed right ... distance ...«

The block »steer ... speed left ... speed right ... distance ...« programs the robot to drive a curve by setting different speeds for the left and right motor and also a distance related to the middle between both wheels. The robot configuration influences the radius of the curve depending from wheel distance and wheel diameter. The turning direction will define the driving direction.

Settings and input values:


»show text«

With the »show text« block you can display text and numbers on the display of your robot. You can also specify in which column and row the text or numbers should be displayed on the robot screen.

The EV3 display contains some rows and columns, counted from 0 in the top left corner.

If there was text on the display prior to the show text block then the former text will be overwritten.

Input values:

»show picture«

With the »show picture« block you can show one of some stored pictures on the EV3 display of your robot. Avaliable pictures are »glasses«, »eyes open«, »eyes closed«, »flowers«, »tacho«.

Settings and input values:

»clear display«

With the »clear display« block you can delete text and numbers on the display of your robot, therefore nothing appears on your display.

Settings: none

»play frequency«

With the »play frequency« block you can program the frequency (pitch level) and the time (how long the sound should be played) that a sound is played. The sound is played by the built-in speaker of your LEGO MINDSTORMS EV3 brick for a defined of time. The frequency setting corresponds directly to the frequency in Hertz, for example, setting the frequency to 400 corresponds to 400 Hertz. Example: 261 = C.

Note that the human ear can perceive frequencies from about 30Hz to about 15,000Hz (15kHz). This can vary depending on the person and their age.

Settings:

»play note ... «

With this block you can make a robot play a note.

Options:


»play file«

With the »play file« block your robot plays one of five stored sounds.

Settings:

»set volume«

With the »set volume« block you can program the sound volume played. The volume ranges from 0 (no sound) to 100 (full volume). The volume setting remains unchanged until you change it with another »set volume« block.

Setting:

»get volume«

With the »get volume« block you can read the currend sound volume level.

Return value:

»set language ... «

With this block you can control the language of your robot. If you are using C4EV3 as your robot system, you will need to download additional files for the speech. You can find instructions here.

Options:


»say text ... «

With this block you can control the voice output of your robot. The robot uses the language you set with the "Set Language..." block. The default language is German.

Input values:


» say text ... voice speed ... voice pitch ... «

With this block you can control the voice output of your robot. You can also control your robot's voice pitch and speaking speed.

Input values:


»Brick light«

With the »brick light« block you can program the background light of the EV3 buttons. In addition to color, you can also turn on and off the EV3 brick light. The EV3 brick light stays on until you reprogram it. The following colors are available: »green«, »orange« or »red«.

Settings:

»Brick light off«

With the »brick light off« block you can turn off the brick light.

»reset EV3 brick light«

With the »reset EV3 brick light« block you can reset EV3 brick light back to the default settings.

Settings: none

»touch sensor«

With the block »touch sensor« you can "tell" another block whether the touch sensor is pressed or not. This block returns the logical values true = pressed or false = not pressed. This block can only be used in conjunction with another block which requires a logical value as an input parameter, for example together with the »if then« block.

Settings:


Return value:

»get distance/presence« ultrasonic sensor

With the block »get distance/presence« you "tell" another block the distance the ultrasonic sensor measures. The distance is transmitted as a number (in cm). In addition, this block can be set to "presence" in the drop down menu. This setting can check whether another ultrasonic sensor is active. This setting specifies the logical values true = another ultrasonic sensor is present or false = no other ultrasonic is present back.

Ultrasound, which was not sent by the own ultrasonic sensor, can result in erroneous measurements.

Settings:


Return value:

»get colour light sensor / colour sensor Port ... «

With the block »get colour« you can "tell" another block which color the light sensor measures. The color is transmitted as type »colour« . In addition, this block provides within the drop down menu the settings »light«, »RGB« and »ambient light«. These three additional settings transmit all the same type »number«. The numerical values are between 0 (black) to 100(white). With these various settings this block can be configured according to the specific requirements.

In mode »colour« the light sensor emits light and detects the basic colour under the sensor. Values for basic colours are BLACK, WHITE, RED, GREEN, BLUE, YELLOW, BROWN. The colour GREY means, that the registered colour doesn't match any of the predefined ones.

In mode »light« the light sensor emits light with its red LED and measures the light intensity of the reflected light on a scale of 0 to 100.

In the mode »RGB« the light sensor emits red, green and blue light and measures the reflected light corresponding to the components red, green and blue on a scale from 0 to 100 for each color. A list of three numbers is returned.

In mode »ambient light« the same scale (0-100) as in the mode light is used. Here, the ambient light inciding the sensor is measured.

Settings:


Return value:

»give distance/presence« infrared sensor

With the block »give distance/presence« for infrared sensor you can "tell" another block which distance the infrared sensor measures.

Working in the "distance" mode the distance is transmitted as a number with values between 0 (very close) and 100 (far away). In this mode the sensor detects objects in a distance up to 70 cm.

In addition, this block can be set to "presence" mode in the drop down menu. With this setting you can check whether an infrared sender/beacon is active. This setting returns a list of 4 pairs of values, i.e. 8 numbers. Each pair of values indicates an orientation value and a distance value of the infrared sender. The first pair of values is related to channel 1 of the sender, the second pair to channel 2 etc. Orientation values are between -25 and +25. The value of 0 indikates that the infrared signal comes directly from the front. Values out of the -25/+25 range represent angles of 110° to the left or right, respectively. The distance value of the sender is a relative value between 0 (very close) and 100 (far away). Infrared signals may be detected from a maximum distance of 200 cm.

Example: Result of an infrared sensor measure is [ 0 0 -10 40 0 0 0 0 ]. This means that on channel 2 the direction of the sender/beacon gives a value of -10, which is about 60 degrees to the left, while the distance value of 35 has been found, which represents nearly 70 cm.

An exact measurement of distances in cm is not possible with the infrared sonsor.

Settins:


Return value:

»reset encoder«

With the block »reset encoder« the internal sensor (motor encoder) of a motor can be reset to 0 .

Setting:

»get rotation/degree« rotation sensor

With the block »get rotation/degree« you can "tell" another block the rotation of the motor. The distance is transmitted as a number (in cm). In addition, this block can be set to »degree« in the drop down menu. With this setting the number of degrees is transmitted instead of cm. This block can only be used in conjunction with another block, which requires a number as an input parameter.

Settings:


Return value:

»button« EV3 buttons

With the block »button« you can "tell" another block whether the selected button is pressed or not. Available buttons are »enter« / »up« / »down« / »left« / »right« / »escape« / »any«. This block returns logical values true = pressed or false = not pressed.

Settings:


Return value

»reset gyroscope«

With the block »reset gyroscope« the gyroscope (also called gyro sensor) can be reset to 0.

Settings:

»get angle/rate« gyroscope

With the block »get angle/rate gyroscope« you can "tell" another block the angle in which the gyro sensor was rotated around its vertical axis. The angle is transmitted as a number. Alternatively the return value can be set to »rate« in the drop down menu. This setting allows to send the rotation rate of the sensor in "degrees per second" instead of the angle.

In mode »rate« a maximum of 440 degrees/second can be captured. In mode »angle« the accuracy of the gyro sensor is +/- 3 degrees.

Settings:


Return value:

»get value« timer

With the block »get value« you can "tell" another block the current time in milliseconds of the internal timer. 5 timers are available.

Setting:


Return value:

»reset timer«

With the block »reset timer« the internal timer (1 to 5) can be reset to the value 0.

Setting:

»get sound % sound sensor port ... «

This block allows you to query the volume that the sound sensor measures.

Options:


Return value:


»calibrate HT compass sensor port... «

Use this block to recalibrate a connected HT compass sensor. This sensor measures the earth's magnetic field and calculates a current orientation of your robot from its course. In order for this calculation to be as accurate as possible, you must recalibrate the compass sensor at the beginning of your program to reduce disturbing influences such as motors.

Options:


»get ... HT compass sensor port ... «

With this block you can request different values of the compass sensor. The compass sensor can measure the angle and compass orientation of your robot. However, you should recalibrate the sensor before using it in your program.

Options:

Return value:

»get ... HT infrared sensor port ... «

With this block you can poll the HT infrared sensor of your robot. This sensor sends and receives infrared signals and can calculate the distance to an object.

Options:


Return value:


»get ... HT colour sensor port ... «

With this block you can query the HT color sensor of your robot. This sensor uses several light emitting diodes to illuminate the background and then measures which color is reflected how much. From these values you can calculate colors and RGB values. The sensor can also measure the brightness of the background and the environment.

Options:


Return value:


»if do«

With the block »if do« you can selectively trigger actions to be executed by your robot. The »if do« block therefore requires a logical value as an input parameter, the condition. Only if the condition of the »if« statement is true, the inserted block will be executed. In a nested »if do« block, if a further distinction was added, the first »if« condition is queried. If it is not fulfilled (condition = false), the second »else if« condition will be checked. Also this second condition requires a logical value as an input parameter.

The conditions may arbitrarily be expanded by clicking the "+" plus symbol. The "-" minus symbol reduces the block.

Settings and input values:

»if do else«

With the block »if do else« you can selectively trigger actions which are executed by your robot. The »if do then« block therefore requires a logical value as an input parameter. If the condition in »if« is true the inserted block will be executed, otherwise (condition is not fulfilled = false) the block connected to the »else« statement will be executed. In a nested »if do else« block with further distinctions added, the first »if« condition is queried. If it is not true, the second condition »else if« is checked. Also the second condition requires a logical value as an input parameter. Only when both conditions are not true, the block which is inserted at the »else« statement will be executed.

The conditions may arbitrarily be expanded by clicking the "+" plus symbol. The "-" minus symbol reduces the block.

Settings:

»repeat indefinitely«

With the block »repeat indefinitely« you can endlessly run the blocks on your robot. All blocks which are within the »repeat indefinitely« block will be executed endlessly. The blocks are applied sequentially from top to bottom. Once the last block has been executed, the program repeats with the first block again. Therefore, this block is also called »loop«.

Input:


»repeat n times«

With the block »repeat« you can run other block as many times as you like. All blocks in the »repeat« block will be executed as often as defined in the entry field. The blocks are applied sequentially from top to bottom. Once the last block has been executed, the program repeats with the first block again. Therefore, this block is also called »loop«.

Only integer values can be entered.

Settings and input:


»wait«

With the block »wait« you can "pause" your program at the point where you inserted the »wait« block. Your program will then remain for the specified duration at this point. After the specified time the next block will be executed. For example you can display text in the screen of your robot for exactly the time you specified in the »wait« block.

Settings and input values:

»wait until ...«

With the block »wait until« you can "stop" your program at the point you insert the »wait until« block. Your program then waits until the condition is true. The »wait until« block you can extended by click on "+" symbol. Your program then waits until (at least) one of the condition of your »wait until« block is true.

Settings:

»wait until ... «

With the block »wait until« you can "stop" your program at the point you insert the »wait until« block. Your program then waits until the condition is true. The »wait until« block you can extended by click on "+" symbol. Your program then waits until (at least) one of the condition of your »wait until« block is true.

Settings:

»break out/continue with next iteration of loop«

With the block »break out/continue with next iteration of loop« a loop can be terminated ahead of schedule. As soon as the block is entered within a sequence of blocks, all further blocks up to the end of the loop will be ignored.

Settings:

»count with from to«

With the block »count with from to« you can run other block as many times as you like. All blocks in the »count with from to« block will be executed as long as the counting is in progress. The blocks are applied sequentially from top to bottom. Once the last block has been executed, the program repeats with the first block again if the counting is in progress. The last parameter declares the step width for counting.

Settings:

»for each item in list«

With the block »for each item in list« all list items will successively be bound to a variable. The variable can be used within the loop. With each loop cycle the next item of the list will be bound until all list elements have been processed.

Settings and input value:

»repeat while/until«

With the block »repeat while/until« you can run other block as many times as you like. All blocks in the »repeat while/until« block will be executed as long as the condition in the entry field is true. The blocks are applied sequentially from top to bottom. Once the last block has been executed, the program repeats with the first block again if the condition is still true. Therefore, this block is also called »conditional loop«.

Settings and input values:

»comparison«

With the block »comparison« you can compare different parameters of the same type (number, color, logical value, text). This block can only be used in conjunction with another block which requires a logical value as an input parameter.

Settings and input values:

Return value:

»and/or«

With the block »and/or« you can interrelate logical values with each other. The »and/or« block with the setting "and" will be true only if both logical parameters are "'true"'. If the block has the setting »or« it is sufficient if one of the two parameters is "true", so that the »and/or« block will return true.

Settings:


Return value:

»true/false«

With the block »true/false« you can return either the logical value »true« or »false« to another block.

Settings:


Return value:

»not«

Using the »not« lets you invert a logical value and pass this value to another block.

Input value:


Return value:

»test«

Using the »test« block will perform a test and returns a value which depends on the test result.

Input values:


Return value:

»null«

The block »null« is a place holder for an input value that is not yet specified. If for instance a new connection variable has been created and is not yet bound, the initial value of this connection will be set to »null«.

Return value::

»parameter«

With the block »parameter« you can send numbers to another block.

Settings and input values:

Return value:


»calculating«

With the block »calculating« you can sum up, subtract, multiply, and divide numbers. This block can only be used in conjunction with another block which requires a number as an input parameter.

Settings and input values:


Return value:

»mathematical function«

With the block »mathematical function« some elementary mathematical functions may be calculated. Available functions are »square root«, »absolute«, »invert« (multiply by -1), »ln« (natural logarithm), »log10« (decadic logarithm), »e^« (exponential function), »10^« (base 10 exponent)

Settings and input value:


Return value:

»trigonometric functions«

With the block »trigonometric function« sine, cosine, tangent and their respective revers functions can be calculated. Input values are expected in radian measure(see hint above).

Settings and input value:


Return value:

»constant«

With the »constant« block some mathematical constant values are available: »π« (3,1415...), »e« (2,718...), »φ« (1,618...), »sqrt(2)« (1,414...), »sqrt(½)« (0,7071...), »∞«

Settings:


Return value:

»number property«

With the block »number property« you check whether a given number has a specific property: »even«, »odd«, »prime«, »whole«, »positive«, »negative«, »divisible by«.

Settings and input values:


Return value:

»change by ... «

The block »change by ... « increments a numerical variable by a defined value.

Settings and input values:

»round«

With the block »round« values may be rounded. Rounding will set the decimal places to 0. It depends on the value of the decimal places whether the block rounds up or down. You may also decide by settings to always round up or down.

Settings and input value:


Return value:

»list evaluation«

With the block »list evaluation« you may analyse a list.

Modes for list evaluation:


Settings and input value:


Return value:

»remainder of«

The block »remainder of« calculates a divison and returns the remainder of the division.

Input values:


Return value:

»constrain«

The block »constrain« ensures that given boundaries will not be exceeded.

Input values:


Return value:

»random integer«

With the block »random integer« you may generate random integer numbers within defined limits

Input values:


Return value:

»random fraction«

With the block »random fraction« a random value between 0.0 and 1.0 is calculated.

Return value:

»cast ... to String«

This block converts a number into a string containing that number. So for example the number 123 would be converted into the string »123«.


Options and input values:


Return value:


»cast ... to Char«

This block converts a single number to the corresponding ASCII letter. If there is no associated ASCII character for this number, an empty string is passed on. So for example the number 97 gets converted into the lower-case letter »a«.

Options and input values:


Return values:


»Text«

The simple »Text« block creates a little text.

Input value:


Return value:

»comment«

Document your program with this block, so that you and others will find it easier to understand your program later. This comment will also be visible in the generated source code.

Input value:

»create Text«

The »create text« block compiles a text from different input parameters. Using the + sign will insert further input slots. All input parameters will be connected one after the other. Essentially the »create text« block converts an arbitrary input value into a text string.

Input values:


Return value:

»append Text«

The »append text« block will append some string to a given string, for instance to extend a message with a signature.

Input values:

»cast ... to Number«

This block converts a string into a number if this is possible. So if a string contains only numbers, this block can convert the string into a number. If the block does not contain numbers, this block will pass »NaN« when used in th Open Roberta Lab simulation and may have a different behavior depending on the programming language of the robot you are currently using. If the string starts with numbers but then contains other characters that are not numbers, this block will pass only the numbers and stop as soon as the first character is in the string. So, as an example, this block makes the number 52 out of the string »52abcd«.

Options and input values:


Return values:


»cast ... at index ... to Number«

This block converts a letter or a character from a character string into the corresponding ASCII number. Each character has an associated number in the ASCII table. For example, a lower-case »a« is converted into the number 97.

Options and input values:


Return values:


»create list«

The block »empty list« creates a list with no content.The block »list« generates a list with some predefined values.

This block may only be used in the context of a »set variable« block.

Using »+« or »−« enables you to extend or reduce the list at its end.

Settings and input values:


Return value:

»repeat element in list«

The »repeat element in list« block generates a list of equal elements.

Settings and input values:


Return value:

»length of«

The »length of« block returns a value which is the length of the list given as parameter. An empty list has a length of 0.

Input value:


Return value:


»is empty?«

A list given as parameter will be checked whether it is empty.

Input value:


Return value:

»find in list«

A list is searched for an item. If the item is in the list, the list position will be returned. If the item is not in the list the result is -1.

Settings and input values:


Return value:

»get list element«

This block accesses an item of a list. Depending on the settings this item may be altered.

A list is given as parameter. Then a drop-down-list specifies what will happen to the list item under consideration.

Settings:


Return value:

»set list element«

In a list given as input parameter one specified element will be replaced by a new value.

Settings and input values:

»get sublist«

From a list given as parameter a sublist will be created. The sublist contains all those elements that match the further specifications of the block.

Settings and input values:


Return value:

»Colour picker «

With this block you can choose from a pool of predefined colours for your robot.

options:


Return value:


»Colour picker «

With this block you can choose from a pool of predefined colours for your robot.

options:


Return value:


»Colour picker «

With this block you can choose from a pool of predefined colours for your robot.

options:


Return value:


»Colour with red ... green ... blue ... white ... «

With this block you can create your own colour by mixing red, green and blue.

Input values:


»Colour with red ... green ... blue ... «

With this block you can create your own colour by mixing red, green and blue.

Input values:


»Colour with red ... green ... blue ... «

With this block you can create your own colour by mixing red, green and blue.

Input values:


»set variable«

Using the block »set variable« will assign a value to a variable. Depending on the variable type the value may be assigned by an input connector.

Settings and input value:

»get variable«

Using the block »get variable« returns the value of a variable to another block.The type of the output parameter is equal to the type that has been assigned to the variable in the »start« block.

Settings:


Return value:


»Function blocks with/without input parameters and no return statement«

In a function block with/without input parameter and without return parameter a sequence of program statements will be condensed. The input parameters will be determined by the local variables of the function block. Local variables may be generated by using the »+« sign of the function block. Local variables will not be initialized.

If a function block contains an if-block the function may be terminated before reaching it's end.

The function block is available in the »Functions« category immediately after its definition. Using function blocks improves the readability of complex programs.

Settings:


  • The name of a function block has to start with a lower case letter. Special characters are not allowed in a function block name.

  • If the function block defines input parameters (local variables), all the parameter slots have to be occupied when calling the function.

»Function blocks with/without input parameters with return statements«

In a function block with/without input parameter and with return parameter a sequence of program statements will be condensed. The input parameters will be determined by the local variables of the function block. Local variables may be generated by using the »+« sign of the function block. Local variables will not be initialized. After running through all the blocks of the function a value will be returned.

If a function block contains an if-block the function may be terminated before reaching it's end. An alternative value may be returned by the if-block.

The function block is available in the »Functions« category immediately after its definition. Using function blocks improves the readability of complex programs.

Settings:


Return value:


  • The name of a function block has to start with a lower case letter. Special characters are not allowed in a function block name.
  • If the function block defines input parameters (local variables), all the parameter slots have to be occupied when calling the function.

»if block to be used within a function«

The if statement within a function is of special importance. As the function sequence meets an if statement the validity of the condition will be checked.

If statement within a function with return value:

If statement within a function with no return value:

Settings and input values:


Return value:



»function call without return value «

With this block you can call a previous defined function in your program.

Input values:

»function call with return value «

With this block you can call a previous defined function in your program.

Input values:

Return value:

Connect to robot name

A message interchange connection is initiated by an EV3 robot, like a telephone call that is initiated by the caller. You need to know the name of the communication partner.

The connection between two EV3 robots is stored in a global variable of type "connection". As long as this global variable is valid the message connection is available.

Step 1: Create a global variable of type "connection".

Step 2: Enter the name of an EV3 robot that is partner of the message exchange.

The connection variable of the communication partner will automatically be initiated by using the expert block "wait for connection" (see below). The connection variable will be initiated when the calling EV3 robot has established the connection by using the block "connect to robot name".

Input value:


Return value:


Data to send via connection

A text message will be transferred using a global connection variable. The text message will be entered in a text block. To give the connection information to the EV3 robot the value of the global connection variable will be read.

Currently only strings can be sent via bluetooth.

Settings:


Data received via connection

A text message will be transferred using a global connection variable. The text message will be transferred into a text block. To give the connection information to the EV3 robot the value of the global connection variable will be read.

Settings and input value:


Return value:


Wait for connection

A message interchange connection is initiated by an EV3 robot, like a telephone call that is initiated by the caller. A robot that is called is waiting for a connection.

The connection between two EV3 robots is stored in a global variable of type "connection". As long as this global variable is valid the message connection is available.

Step 1: Create a global variable of type "connection".

Step 2: The value of the connection variable is set to the expert block "wait for connection".

The connection variable will be set when the calling EV3 robot has initiated the connection (see above: connect to robot name).

Return value: