The Start each time block offers the option of running a program when a condition is fulfilled. Therefore, it works similar to a case distinction, but runs not only one time, but rather every time the condition is fulfilled during the entire course of the program. The Start each time block:
Is an abbreviation for the following construct:
You can insert all conditions from this category into the I2C category in the Start each time block.
Note: The program section in the Start each time block should be kept short, and should not contain any blocking calls or endless loops, so that this part of the program can be processed quickly.
The environmental sensor combines the four functions of an air quality sensor, humidity sensor, barometer, and thermometer in one component.
You can use the get environmental sensor humidity block to measure the humidity.
Use the environmental sensor humidity [] ... [] ... block to query whether you are measuring a certain humidity. You can use the drop down menu (small triangle) to select how the humidity should be compared to the entered value (<, ≤, =, ≠, ≥, >) . The comparison value is entered in the number field at the end of the block. This block can be used as a condition. In the example, the motor is stopped when the humidity is greater than 10.
You can use the get environmental sensor air quality as [] block to measure the air quality. You can use the drop down menu (small triangle) to select whether the air quality should be returned as a numerical value (from 0 to 500) or as a text.
Use the environmental sensor air quality [] ... block to query whether you are measuring a certain air quality. You can use the drop down menu (small triangle) to select how the air quality should be compared to the entered value (<, ≤, =, ≠, ≥, >) . The comparison value is entered in the number field at the end of the block. This block can be used as a condition. In the example, the motor is stopped when the air quality is greater than 10.
You can use the get environmental sensor air pressure block to measure the air pressure.
Use the environmental sensor air pressure [] ... block to query whether you are measuring a certain air pressure. You can use the drop down menu (small triangle) to select how the air pressure should be compared to the entered value (<, ≤, =, ≠, ≥, >) . The comparison value is entered in the number field at the end of the block. This block can be used as a condition. In the example, the motor is stopped when the air pressure is greater than 10.
You can use the get environmental sensor temperature block to measure the temperature.
Use the environmental sensor temperature [] ... block to query whether you are measuring a certain temperature. You can use the drop down menu (small triangle) to select how the temperature should be compared to the entered value (<, ≤, =, ≠, ≥, >) . The comparison value is entered in the number field at the end of the block. This block can be used as a condition. In the example, the motor is stopped when the temperature is greater than 10.
The combi sensor combines the three functions of an acceleration sensor, gyroscope, and compass sensor in one component.
Use get combi sensor acceleration in [] to obtain the acceleration in one spatial direction. You can select the desired spatial direction using the drop down menu (small triangle). The acceleration is indicated in g.
Use the combi sensor acceleration in [] [] ... block to query whether you are measuring a certain acceleration. You can use the drop down menu (small triangle) to select how the acceleration should be compared to the entered value (<, ≤, =, ≠, ≥, >) and what spatial direction should be queried. The comparison value is entered in the number field at the end of the block. This block can be used as a condition. In the example, the motor is stopped when the acceleration in the x direction is greater than 10.
Use get combi sensor magnetic flux in [] to obtain the magnetic flux in one spatial direction. You can select the desired spatial direction using the drop down menu (small triangle). The magnetic flux is indicated in μT.
Use the combi sensor magnetic flux in [] [] ... block to query whether you are measuring a certain magnetic flux. You can use the drop down menu (small triangle) to select how the magnetic flux should be compared to the entered value (<, ≤, =, ≠, ≥, >) and what spatial direction should be queried. The comparison value is entered in the number field at the end of the block. This block can be used as a condition. In the example, the motor is stopped when the magnetic flux in the x direction is greater than 10.
Use get combi sensor rotation in [] to obtain the rotation in one spatial direction. You can select the desired spatial direction using the drop down menu (small triangle). The rotation is indicated in °/s.
Use the combi sensor rotation in [] [] ... block to query whether you are measuring a certain angular speed. You can use the drop down menu (small triangle) to select how the rotation should be compared to the entered value (<, ≤, =, ≠, ≥, >) and what spatial direction should be queried. The comparison value is entered in the number field at the end of the block. This block can be used as a condition. In the example, the motor is stopped when the rotation in the x direction is greater than 10.
The RGB colour sensor combines functions for colour measurement and control of 3 LEDs in one component. Up to 8 sensors can be operated in series on the TXT 4.0 controller.
The RGB colour sensor can be connected to the EXT1 or EXT2 connection.
The RGB colour sensor must not be connected to the EXT1 and EXT2 connections at the same time.
Up to 8 RGB colour sensors can be connected. Additional colour sensors are connected with their IN connection to the OUT connection of a previous colour sensor.
The sensor can be used to query various colour values, similar to the gesture sensor.
The "Set RGB colour sensor [] No [] measurement time []" block is used to set the time required to measure the values. The longer the time, the more precise the measured values will be.
The "Set RGB colour sensor [] all LEDs off in [] seconds" block is used to automatically switch off the LED lighting. The LEDs of all sensors are dimmed down to the value 1. The default value is 0 seconds or no AutoOff.
The "get RGB color sensor [] No" block makes it possible to query the number of sensors connected in series.
The "get RGB color sensor [] No [] []" block makes it possible to retrieve many different data from the RGB colour sensor. Depending on the selection in the drop-down menu, the following information can be obtained:
The block "is RGB color sensor [] No [] [] [] [] ...", which serves as a condition, performs the following functions:
The following example shows how the "is RGB colour sensor" block is used to react to a specific status. In the case shown, a check is made to see whether the red value (RGB red) of the RGB colour sensor is 0. If this condition is met, the programme executes an action - in this case, stopping a motor.
Each sensor has 3 LEDs that can be controlled separately.
With the block "set RGB colour sensor [] no[] LED [] brightness ...", you can set the LED brightness to a specific value (from 0 to 255).
In the example, the LED is switched on and its brightness is set to the maximum possible value. This makes it possible to operate the LED in its brightest state.
With the block "is RGB colour sensor [] no [] LED [] brightness [] ..." you can use the activity or brightness of an LED as a condition.
The following example shows how the block reacts to a specific condition. In the case shown, the programme checks whether the value of the first LED is 0. If this condition is met, the programme executes an action - in this case, stopping a motor.