#define speaker1 19
void setup() {
// array of GPIO pins
int ledPins[] = {15, 2, 4, 5};
int numLeds = 4;
int i = 0;
int j =0;
pinMode(speaker1, OUTPUT);
for (i=0; i < numLeds; i++) {
pinMode(ledPins[i], OUTPUT);
}
for (i=0; i < 40; i++) {
if( ( i % 10)==0)
{
digitalWrite(ledPins[j], HIGH);
Serial.print("j: ");
Serial.print(j);
// make sound
tone(speaker1, 170 + 100*i); // Send 1200KHz sound signal, which is a G tone
delay(50);
noTone(speaker1); // Stop sound
delay(10);
j++;
delay(250);
}
}
}
void loop() {
// No code needed in the loop for this example
}