0% found this document useful (0 votes)
60 views3 pages

Project 7: 01. Keyboard Instrument

This project creates a simple musical keyboard using an Arduino, piezo buzzer, buttons, and resistors. The circuit connects four buttons in parallel with resistors to create different voltage readings for each button. The Arduino code uses these analog readings to play different notes on the piezo buzzer corresponding to each pressed button.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views3 pages

Project 7: 01. Keyboard Instrument

This project creates a simple musical keyboard using an Arduino, piezo buzzer, buttons, and resistors. The circuit connects four buttons in parallel with resistors to create different voltage readings for each button. The Arduino code uses these analog readings to play different notes on the piezo buzzer corresponding to each pressed button.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Project 7

 Assignment:01

01. Keyboard Instrument .


 Circuit 1 (Keyboard Instrument) :

 Code:

int notes[]={262,294,330,349};

void setup()

0
{

Serial.begin(9600);

void loop()

int keyVal = analogRead(A0);

Serial.println(keyVal);

if(keyVal == 1023){

tone(8,notes[0]);

else if(keyVal >= 990 && keyVal<=1010){

tone(8,notes[1]);

else if(keyVal >= 505 && keyVal<=515){

tone(8,notes[2]);

else if(keyVal >= 5 && keyVal<=10){

tone(8,notes[3]);

1
else{

noTone(8);

 Summary :
In this project,I made a small musical keyboard using buttons and the
piezo buzzer.
This project I used :
 1 piezo buzzer
 4 pushbuttons
 2 10 k-ohm resistors
 1 220 ohm resistor
 1 M-ohm resistor
 1 Arduino Uno
 1 breadboard!
Here, we put four switches in parallel. In three branches we connected a
resistor in series with the switch and in the fourth one a wire connected
directly to power. This kind of structure is called a mixed resistor circuit.
Each resistor had a different value, so every time we pushed one switch the
voltage read by the analogic entrance was different. Then, in function of
this value, the piezometer vibrated at a different frequency.

You might also like