Skip to the content.

double counter program

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 page 1

double counter page 1 program

This page implements a counter using variable X and button A button A. When button B button B is pressed, we switch to page 2 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 variable X value

The next two rules, implement a counter using the variable X and button A.

when button A pressed, increment X

when press button A, increment variable X

Finally, the last rule switches to page 2 to have the other counter.

when press button B, switch to page 2

page 2 page 2

double counter page 2 program

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.