Electronic Organ

by Rosamking in Circuits > Arduino

2490 Views, 18 Favorites, 0 Comments

Electronic Organ

作品图片2.jpg

Hello, Everyone. This is a series of courses, I will share how to use cartons and arduino to make something interesting,today,I'll share with you a Electronic Organ.The project is relatively simple, so according to the steps produced is not too difficult.

You Need to Prepare These Materials

8a8e1c38f87bcfdfde9aa456d594d6e.png

Circuit Diagram

1-5.png
1-6.png

Assembly

2.jpg
3.jpg
4.jpg
5.jpg
6.jpg
7.jpg
8.jpg
9.jpg
10.jpg
11.jpg
13.jpg
12.jpg

Code

void setup()

{

pinMode(1, INPUT);

pinMode(13, OUTPUT);

pinMode(2, INPUT);

pinMode(3, INPUT);

pinMode(4, INPUT);

pinMode(5, INPUT);

pinMode(6, INPUT);

pinMode(7, INPUT);

}

void loop()

{

analogWrite(10,1);

if (digitalRead(1)) {

tone(13,262);

} else if (digitalRead(2)) {

tone(13,294);

} else if (digitalRead(3)) {

tone(13,330);

} else if (digitalRead(4)) {

tone(13,349);

} else if (digitalRead(5)) {

tone(13,392);

} else if (digitalRead(6)) {

tone(13,440);

} else if (digitalRead(7)) {

tone(13,494);

} else {

noTone(13);

}

}

GameRules

作品图片1.jpg

Press a button and the electronic organ makes a sound.

These seven buttons correspond to DO,RE,MI,FA,SUO,LA,XI