Goal: Pass the value for the delay block in previous program as a variable.
Variables are used when we want to store the data in the program. You can use them to hold values and then come back to them when you want to use that value. For example in the previous program, we have used 1000 ms for the delay block at two places. Instead of passing the value directly, we can store the value in a variable and then pass the variable to the delay block.
On the action window in Minibloq, there is a button that looks like a can. An empty can will define a new variable, and can only be used at the top of the program. A full can will reassign a variable's value.
Click the empty can to initialize a new variable.
Give it a name "delay".
Assign a value 1000.
Now in the previous program pass the delay variable for the delay block.
Complete program is shown below.
Run the program and check your results.
Activity: Blink "Hello World" 3 times. Delay between first and second is 1 second. Delay between second and third is 2 second. Use variables.