TINKER PiEDESIGN IN INDIA

Button counter

Use a variable to count button presses. Beginner · 10 min

Start this tutorial in TinkerPie Studio

Step by step

  1. Make a variable

    Open Variables and press Create variable…. Call it count.

  2. Start at zero

    Put set count to 0 inside on start.

  3. React to button A

    From Input, drag on button A pressed onto the workspace. Inside it put change count by 1.

  4. Show the number

    Add show number under it and drop the round count block into its slot.

  5. Test in the simulator

    Press Run, then click button A on the board picture (or press the A key). The number goes up.

  6. Add a reset

    Add on button B pressed with set count to 0. Now B starts again from zero.

Questions

What is a variable?

A variable is a named box that stores a value, such as a number. Here, count remembers how many times button A was pressed.

Do I need the TinkerPie board for this tutorial?

No. Press Run and click button A on the board picture, or press the A key on your keyboard. On a real TinkerPie V1, press the A button.

What should I try next?

Try Rainbow and JavaScript to see your blocks as code, or open a ready-made project.