Introduction: Simple Piano

About: a guy who likes robotics

piano thing

Supplies

buttons

buzzer

potentiometer

breadboard

arduino uno

wires

Step 1: Add Arduino

add

Step 2: Add Breadboard

Step 3: Add Potentiometer

Step 4: Add Buzzer

Step 5: More Wires

Step 6: More Wires

Step 7: Bunch More Wires

add more wires

Step 8: Add More Wires

add more wires

Step 9: Add a Bunch More Wire

wires

Step 10: Resistor

add resistors

Step 11: Buttons

add buttons

Step 12: 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); 

}