banjorobbie
New Member
Forgive me Mike, I keep missing your edits! Just checking some things now
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
void loop() {
int potVal = map(analogRead(A2), 0, 1024, 0, 3);
for (int i = 0; i < numberOfButtons; i++) {
checkButton(potVal,i);
}
}
void checkButton(int scaleNum,int buttonNum)
{
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin[buttonNum]);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonState == HIGH) {
digitalWrite(ledPin[buttonNum], HIGH);
tone(speaker, notes[scaleNum][buttonNum]); // play the note
delay(100); // wait for 1/10th of a second
} else {
digitalWrite(ledPin[buttonNum], LOW);
noTone(speaker); // stop playing the note
}
}