Professional Documents
Culture Documents
Assignment:01
Code:
int notes[]={262,294,330,349};
void setup()
0
{
Serial.begin(9600);
void loop()
Serial.println(keyVal);
if(keyVal == 1023){
tone(8,notes[0]);
tone(8,notes[1]);
tone(8,notes[2]);
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.