For our arduino project we changed the amount of time until one pattern of beeping turns into another (similar to a siren).
float sinVal;
int toneVal;
int k=0;
void setup () {
pinMode(8,OUTPUT);
}
void loop () {
while (k< 2000){
for (int x=0;x<180;x++) {
// convert degrees to radians then obtain sin value
sinVal = (sin(x*(3.1412/180)));
// generate a frequency from the sin value
toneVal = 2000+(int(sinVal*1000));
tone(8, toneVal);
k++;
delay(2);
}}
for (int x=0;x<180;x++) {
// convert degrees to radians then obtain sin value
sinVal = (sin(x*(3.1412/180)));
// generate a frequency from the sin value
toneVal = 2000+(int(sinVal*1000));
tone(8, toneVal);
delay(5);}
}
URL of video
https://drive.google.com/a/slsharks.net/file/d/0B6Ep8JcC1gm_dXZYR0dSUDVPVEk/view
float sinVal;
int toneVal;
int k=0;
void setup () {
pinMode(8,OUTPUT);
}
void loop () {
while (k< 2000){
for (int x=0;x<180;x++) {
// convert degrees to radians then obtain sin value
sinVal = (sin(x*(3.1412/180)));
// generate a frequency from the sin value
toneVal = 2000+(int(sinVal*1000));
tone(8, toneVal);
k++;
delay(2);
}}
for (int x=0;x<180;x++) {
// convert degrees to radians then obtain sin value
sinVal = (sin(x*(3.1412/180)));
// generate a frequency from the sin value
toneVal = 2000+(int(sinVal*1000));
tone(8, toneVal);
delay(5);}
}
URL of video
https://drive.google.com/a/slsharks.net/file/d/0B6Ep8JcC1gm_dXZYR0dSUDVPVEk/view