Simple Piano
piano thing
Supplies
buttons
buzzer
potentiometer
breadboard
arduino uno
wires
Add Arduino
add
Add Breadboard
Add Potentiometer
Add Buzzer
More Wires
More Wires
Bunch More Wires
add more wires
Add More Wires
add more wires
Add a Bunch More Wire
wires
Resistor
add resistors
Buttons
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);
}