Hi. I'm trying to repeat a beep function that turns on a tone and a digital output for an LED and then turns both off again after a delay.
void beep() {
tone(8, 5000);
digitalWrite(13, HIGH);
delay(100);
digitalWrite(13, LOW);
noTone(8);
}
Pretty simple. But when I put this into a for-loop, I only get one beep.
for (int i=0; i<=10; i++); {
beep();
delay(200);
}
If I modify the code to give me serial outputs in every iteration, it only gives me one output and my variable "i" jumps to 11 immediately.
for (int i=0; i<=10; i++); {
beep();
Serial.print("i = ");
Serial.println(i);
delay(200);
}
Serial Output:
i = 11
I feel like I'm making some obvious rookie mistake here, so I hope someone can help me out.
Thank you!