
value read so that the numbers obtained correspond to the key numbers as
powers of 2. Thus, as an example, when key C is pressed, key_pressed contains
1, when D is pressed, key_pressed is 2, when key E is pressed, key_pressed is 4
and so on. A switch statement is used to load variable tone with the correct
timer value so that the required tone can be generated on the speaker.
Components Required
In addition to the standard components used for the microcontroller, the
following components will be required for this project:
S1 to S8 SPDT switches
R2 to R9 100K, 0.125 W resistors
B1 small speaker
T1 n-channel MOSFET transistor (e.g. VN66AFD)
106
Microcontroller ...