Simple Piano

by roboman5059 in Circuits > Electronics

150 Views, 0 Favorites, 0 Comments

Simple Piano

Super Trug-Snaget (2).png

piano thing

Supplies

buttons

buzzer

potentiometer

breadboard

arduino uno

wires

Add Arduino

Super Trug-Snaget (12).png

add

Add Breadboard

Super Trug-Snaget (11).png

Add Potentiometer

Super Trug-Snaget (10).png

Add Buzzer

Super Trug-Snaget (10).png

More Wires

Super Trug-Snaget (9).png

More Wires

Super Trug-Snaget (8).png

Bunch More Wires

Super Trug-Snaget (7).png

add more wires

Add More Wires

Super Trug-Snaget (6).png

add more wires

Add a Bunch More Wire

Super Trug-Snaget (5).png

wires

Resistor

Super Trug-Snaget (3).png

add resistors

Buttons

Super Trug-Snaget (1).png

add buttons

Code

add code

int pos = 0;


void setup()

{

 pinMode(A0, INPUT);

 pinMode(8, OUTPUT);

 pinMode(A1, INPUT);

 pinMode(A2, INPUT);

 pinMode(A3, INPUT);

 pinMode(A4, INPUT);

 pinMode(A5, INPUT);

}


void loop()

{

 // if button press on A0 is detected

 if (digitalRead(A0) == HIGH) {

  tone(8, 92, 100); 

 }

 // if button press on A1 is detected

 if (digitalRead(A1) == HIGH) {

  tone(8, 165, 100);

 }

 // if button press on A0 is detected

 if (digitalRead(A2) == HIGH) {

  tone(8, 294, 100);

 }

 if (digitalRead(A3) == HIGH) {

  tone(8, 523, 100); 

 }

 if (digitalRead(A4) == HIGH) {

  tone(8, 932, 100); 

 }

 if (digitalRead(A5) == HIGH) {

  tone(8, 1661, 100);

 }

 delay(10); 

}