Button counter
Use a variable to count button presses. Beginner · 10 min
Start this tutorial in TinkerPie Studio
Make a variable
Open Variables and press Create variable…. Call it
count.Start at zero
Put
set count to 0insideon start.React to button A
From Input, drag
on button A pressedonto the workspace. Inside it putchange count by 1.Show the number
Add
show numberunder it and drop the roundcountblock into its slot.Test in the simulator
Press Run, then click button A on the board picture (or press the A key). The number goes up.
Add a reset
Add
on button B pressedwithset count to 0. Now B starts again from zero.