
This program counts how many times you press button A or button B.
Page 1 is used to track A and page 2 for B. This is a more advanced version of the counter sample.
page 1

This page implements a counter using variable X
and
button A. When
button B is pressed, we switch to
page 2.
To get started, we play a sound and show the value of variable X.

- when page start, play happy sound

- when page start, show value of variable
X
The next two rules, implement a counter using the variable X and button A.

- when
press
button A, do
set variable Xto
variable Xplus
value 1

- when
variable X changed, do show variable Xvalue.
Finally, the last rule switches to page 2 to have the other counter.

- when press button B, switch to page 2
page 2

The second page is similar to page 1 but you replace button A with button B, variable X with Y and page 2 with page 1.