pxt-calliope/docs/calliope/firststeps/Variables.md

1.2 KiB

ERSTE SCHRITTE: DAS 5X5 LED RASTER

Introduction @unplugged

As in a football match, where the number of goals scored during the match can change, the value of a variable can also change during a running program.

By clicking on the Variables section and then on the "Make a variable…“ button within this section you will generate a new variable. Now you can determine the name.

Step 1 @fullscreen

By clicking on the Variables section and then on the "Make a variable…“ button within this section you will generate a new variable. Now you can determine the name.

Step 2 @fullscreen

You can find a separate block for each variable, which you can use to display its value on the LED grid of Calliope mini by selecting the "show number 0“ block and use the "set variable to 0“ block from the Variables section and add this on a line before. if you change this number, the number on the grid will change accordingly.

Step 3 @fullscreen

Count your score

By combining what you have learned so far, you can program a simple score counter: When button A is pressed, the number of goals variable is increased by one numerical value and then displayed. Have a try!