P-Comp 3–2 Lab

For this project, I used a different kind of analog sensor to create changes in tone through the speaker. Using a potentiometer, I was able to change the 0 to 1023 value to a good range for tone to come out. My setup and code ended up looking like this:

I ran the analog 0 pin to the potentiometer, where it was also connected to power and ground, and also ran a wire from the digital 8 pin through a resistor to the speaker. The power came from the positive strip for the speaker.

I changed the 0–1023 range to 48–800. I chose this because I was just working around with the numbers and 48 was about the lowest I could hear, and 800 was around the highest pitch I could hear. This code is pretty similar to the lab, just working in a different way with the potentiometer.

Here’s a video of the tone changing from the input of the potentiometer.