float sinVal;
int toneVal;
int k=0;
void setup() {
pinMode(8,OUTPUT);
}
void loop() {
while(k<2000){
for (int x=0; x<360;x++) {
// convert degrees to radians that obtain sin value
sinVal = (1*sin(x*(3.1412/360)));
// generate a frequency from the sin value
toneVal = 200+(int(sinVal*1000));
tone(8, toneVal);
k++;
delay(10);
}}
for (int x=0;x<180;x++) {
//convert degrees to radians then obtain sin value
sinVal = (.5*sin(x*(3.1412/360)));
// generate a frequency from the sin value
toneVal = 500+(int(sinVal*750));
tone(8, toneVal);
delay(.5);}
}
https://drive.google.com/a/giresdschools.net/file/d/0B4EfYsrjIbp_emFvVk5kNUxYaTIzYjlnd21oNGRBSHM0cjNJ/view?usp=sharing
int toneVal;
int k=0;
void setup() {
pinMode(8,OUTPUT);
}
void loop() {
while(k<2000){
for (int x=0; x<360;x++) {
// convert degrees to radians that obtain sin value
sinVal = (1*sin(x*(3.1412/360)));
// generate a frequency from the sin value
toneVal = 200+(int(sinVal*1000));
tone(8, toneVal);
k++;
delay(10);
}}
for (int x=0;x<180;x++) {
//convert degrees to radians then obtain sin value
sinVal = (.5*sin(x*(3.1412/360)));
// generate a frequency from the sin value
toneVal = 500+(int(sinVal*750));
tone(8, toneVal);
delay(.5);}
}
https://drive.google.com/a/giresdschools.net/file/d/0B4EfYsrjIbp_emFvVk5kNUxYaTIzYjlnd21oNGRBSHM0cjNJ/view?usp=sharing
To make the tone change, we changed the amplitude to 0.5. We also changed the delay to 0.5, which made the tone repeat itself rapidly and the amplitude changed the sound.