# Obeleži sve kategorije koje odgovaraju problemu

### Još detalja - opišite nam problem

Uspešno ste prijavili problem!
Status problema i sve dodatne informacije možete pratiti klikom na link.
Nažalost nismo trenutno u mogućnosti da obradimo vaš zahtev.
Molimo vas da pokušate kasnije.

# Working with Blocks from the Input Category¶

The computer processes the data it receives from the input (from the user (pressing a button,…) or the environment (values obtained by sensor readings)). In MakeCode, there is a category of blocks which enables working with input data, more specifically a block category that allows a program to “perform certain actions” based on the information it receives from the user or the environment.

The category contains blocks (commands), which process data obtained from users (by clicking buttons) or the environment (by reading sensory data).

The input data can be obtained from pressing the button A, B or A+B, as well as from reading the values ​​of the sensors for light, temperature, and the accelerometer.

We want to create a program which displays the temperature (in degrees Celsius) when button A is pressed.

Q-2: How many times will the blocks inside of the block be executed?

• once.
• Bravo! The onstart block is one of the blocks from the Basic category, and blocks within it are executed only once during the running of the program.
• an infinite number of times.
• The forever block is the block within which commands will be executed an infinite number of times. The running of this block will never stop on its own. To stop the running of this block, you need to press the stop button (|stop|).

As we have already seen in the examples from the previous lesson, how the program starts and runs depends on which block was applied, or .

In order to enable data entry, that is, to use button A to start or run the program, we need to select the from the category, and from its drop-down list we need to choose the button A.

The block starts the program and all blocks included in it are executed.

We drag the on button ... pressed block onto the work surface, and then we insert in it the block which will allow us to display the value of the temperature.

For displaying the temperature, we will use the block from the category .

After connecting these two blocks, we will select the block from the Input category, which we will drag into the input field of the show number command. The block stores the value received from reading the temperature sensor, which is displayed in degrees Celsius.

The final look of the program:

We will use the simulator to test the program. The program will run after the button is clicked.

Q-3: What will be the trigger for displaying the light level:

Little help: The block stores the value received from the light sensor located on the display (LEDs play the role of the light sensor).

• When button A is pressed, the value of the light level will be displayed.
• Bravo! Pressing button A will display the value of the light level.
• When button B is pressed, the value of the light level will be displayed.
• The answer is not correct! Pressing button A will display the value of the light level.
• When A and B are pressed at the same time, the value of the light level will be displayed.
• The answer is not correct! Pressing button A will display the value of the light level.

Q-4: Look carefully at the blocks. Which of the blocks represents a program that will draw a flower when a movement is made (shake)?

• Block A.
• The answer is not correct!
• Block B.
• The answer is not correct!
• Block C.
• Block D.
• The answer is not correct!

Q-5: Look carefully at the block. What will be the trigger (input) for displaying the direction of the placement of the device:

• When button A is pressed, the direction will be displayed.
• The answer is not correct!
• When button B is pressed, the direction will be displayed.
• The answer is not correct!
• When A and B are pressed at the same time, the direction will be displayed.