This week’s lab really helped me to start thinking about the kinds of projects I can actually make. (I say that every week but it’s true). I started by doing the readings on analog input and output. When reading about the different kinds of uses for analog output, I tested some out. I was able to make the potentiometer work as an analog output and used it to control my LED, which didn’t work for me last week. It’s still very faint though, and you can barely see it in this video. I noticed it didn’t turn off, just low. I’m curious as to how to make it just turn off.
After that, I started to work on the tone lab. I can’t upload the videos directly so here’s a Drive link with videos of the lab with the single FSR and multiple FSRs. This is the code I used for the single FSR. It didn’t work when I copy-pasted from the lab, so I asked ChatGPT why the code wouldn’t run. It was because the instructions said to use “float” to contain “frequency”. When I switched it to an integer value, the code ran smoothly. I also changed the range of the FSR from 200-900 to 0-1100 since that’s the range I saw in the Serial Monitor when measuring the range of the FSR earlier.
After doing the single sensor, I moved to multiple sensors, and attempted to create my own “keyboard”. I tried to write my own function for a sensor and then use variables to replicate the function within void loop(). It did not work, I think because the language I know the best is JavaScript and didn’t create the function properly. I ended up using the code from the lab and ended up with a strange output. When there was no force exerted on the FSR, the speaker still made random noises, which I assumed it drew from the array notes[ ]. The first two FSRs made the same noise, and the third FSR made the noise stop entirely. Something interesting I noticed was when I changed the for loop from “thisSensor < 3” to “thisSensor < 4”, the noise ceased entirely.