void loop () { while (k<2000){ for (int x=0;x<180;x++) { sinVal = (sin(x*(3.1412/180))); toneVal=2000+(int(sinVal*1000)); tone(8.toneVal); k++; delay(2); }}
for (int x=0;x<180;x++) { sinVal = (sin(x*(3.1412/180))); toneVal=2000+(int(sinVal*1000)); tone(8,toneVal); delay (5); } } To change the tone of the siren, we changed the number in the sinVal perenthases. To make it loop and change every five seconds, we set the delay to five.