Set up the breadboard for the rest of the buttons. The code supports up to five buttons. If you want to add more, follow the instructions on the subsequent line, if not, then move onto the next page.
Set up another button on the breadboard exactly as the others were set up, only connect this one to analog pin 6. (Any additional buttons will connect to analog pin 7, then 8, etc. The same concept should also be applied to all subsequent steps.) Add the following code to your current code.
int sensorsix = analogRead(A5); This sets the sensor to its corresponding analog pin. Label each additional sensor with a new name and analogRead pin; e.g., the code for sensor seven would be sensorseven = analogRead(A6);.
Serial.println(sensorsix); int thisPitch6 = map(sensorsix, 0, 1023, 400, 200); This sets the sensor to a defined pitch. To change the pitch, change the last value after the map function (currently 200). The higher the number, the higher the pitch, and vice versa.
if (sensorsix > threshold) { tone(9, thisPitch6, 20); } If the reading from the sensor is greater than the threshold value (as when the button is pushed), then the speaker will emit a tone.