void playBuzzer( int numberofTimes ){
for(int b = 1; b <= numberofTimes; b ++ ) {
analogWrite(buzzer, 20);
delay(500); // ...for 1 sec
analogWrite(buzzer, 0);
delay(500); // ...for 1 sec
return;
}
}
Apart from any other problems in the sketch (I didn't look too closely) this for loop will not work because you return from the function from within it so the for loop never actually loops