You are on page 1of 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