Tone Lab

This week we learned how to generate simple tones using our arduino boards. The lab required an 80hm speaker. I was able to generate tones using my small 12mm round buzzer. Because I was using a different speaker my breadboard did not look the same as the example given in the lab.



My Bread Board


Since I used a small 12mm round buzzer I didn't have to worry about resistors. I connected my buzzer directly to the 5v. I broke my lab into 2 steps.

Step1) Get buzzer to play tone.
I looked on the Arduino site to learn more about the tone function. I was able to get the buzzer to play a tone by using this simple code.

void setup() {

}

void loop() {
// turn off tone function for pin 11:
noTone(11);
// play a note on pin 8 for 200 ms:
tone(8, 440, 200);
delay(200);
}


Step2) Add a Sensor.
Connecting the sensors and the speaker was the most difficult part. My photocells were giving me the same issues I had when I created my stupid pet trick. I had issues controlling the amount of light the photocells read. I placed my card board around the photocell (similar to my stupid pet trick) and my buzzer gave me a wider range of sound.


No comments:

Post a Comment