Buttons

Button blocks are used to specify the actions to be taken when a specific button is pressed. See Fig. 45.

_images/buttons-palette.png

Fig. 45 The palette of KookaBlockly Buttons blocks

The Kookaberry has four buttons beneath the display labelled A, B, C and D.

These buttons are coloured A red, B green, C blue, and D yellow.

_images/kberry-front-photo.png

Fig. 46 Kookaberry - front view showing Display, LEDs and Buttons

Button functions are also available on the virtual Kookaberry which is shown when KookaBlockly’s Show display button is clicked.

_images/kberry-virtual-blank.png

Fig. 47 Virtual Kookaberry

Each block in the Buttons category is described in turn below.

When Button Was Pressed

This is a control loop that performs the actions contained within it whenever the selected button was pressed.

When Button Was Pressed Block

The button options are A, B, C, or D.

was pressed means that the actions within the loop will be performed only once after the selected button press.

When Button Is Pressed

This is a control loop that performs the actions contained within it as long as the selected button is pressed.

When Button Is Pressed Block

The button options are A, B, C, or D.

is pressed means that the actions will be performed repeatedly as long as the selected button is being pressed.

Button was pressed

This is a value block whose result is True (= 1) whenever the selected button was pressed.

Button Was Pressed Block

The button options are A, B, C, or D.

After this value block is used its output reverts to False (= 0) until the next time the button was pressed.

Button is pressed

This is a value block whose result is True (= 1) as long as the selected button is being pressed.

Button Is Pressed Block

The button options are A, B, C, or D.

Th output of this value block reverts to False (= 0) when the button is not being pressed.

Button to Exit Program

This is a combination of two blocks: the button was pressed control loop, as described above, and the exit program action.

Exit When Button Was Pressed Block

The result of using this combination is whenever the button selected was pressed the currently running program will finish.