If it seems a bit dizzy or something, please remember im just getting familiar with all the parts.
#include "pitches.h"
int potPin = 0;
int inPin5 = 5;
int inPin4 = 4;
int inPin3 = 3;
int inPin2 = 2;
int readVal = 0;
void setup() {
pinMode(inPin5,INPUT);
pinMode(inPin4,INPUT);
pinMode(inPin3,INPUT);
pinMode(inPin2,INPUT);
}
void loop() {
if(digitalRead(inPin5) == HIGH){
tone(8, NOTE_C4,10);
}
else if(digitalRead(inPin4) == HIGH){
tone(8, NOTE_G3,10);
}
else if(digitalRead(inPin3) == HIGH){
tone(8, NOTE_A3,10);
}
else if(digitalRead(inPin2) == HIGH){
tone(8, NOTE_B3,10);
}
else if(analogRead(potPin) > 0){
readVal = analogRead(potPin);
tone(8, readVal,10);
}
}
Edit:
The problem must be cause to the IF sentences, I believe.