What is it?
|A set of buttons or switches. As with simple buttons, the panel buttons are activated by pressing them. We can program the button panel so that it executes certain instructions for each button, as though we were using five different switches. In contrast to the simple button, the button panel is an analogue component, so it will be connected to the corresponding string of pins.|
For this lesson you will need:
- 1 x Button panel
- 1 x ZumBloq buzzer
- A ZUM BT 328 controller board or one compatible with Arduino UNO
- A USB cable
Got everything? Let´s get started:
Example 1. Create a program to make different musical sounds according to which button is pressed
We will use this simple example to explain how the button panel works and to check that the program behaves differently depending on which button is pressed. Instructions are assigned to each button to be executed when that button is pressed. In this example, the program will respond as follows:
- When button A is pressed, the buzzer will sound DO, RE.
- When button B is pressed, the buzzer will sound RE, MI.
- When button C is pressed, the buzzer will sound MI, FA.
- When button D is pressed, the buzzer will sound FA, SOL.
- When the button E is pressed, the buzzer will sound SOL, LA, SI.
The program can be modified by changing the tones and the duration of the note, etc.
Make these connections before you start programming:
Connect the button panel to analogue pin A1 and the buzzer to digital pin 10, as shown in the diagram below.