For the Week 4 labs, I first experimented with a flex sensor because I haven’t done so in the past. In my demonstration, the flex sensor is connected to A1. The LED light is connected to pin 9 of my Arduino Nano. The bottom of my flex sensor is connected to ground and a 220-ohm resistor. The brightness of the LED light ranged from 0 to 255. For some reason, the light would turn off each time I pressed the flex sensor rather than the other way around. I spoke to a resident, but we could not figure out the issue. Additionally, I had a lot of difficulty with the LED light because the wire connecting my Arduino Nano to ground was severed. By using a multimeter, I detected the absence of voltage and resolved the issue.
Code on Github: https://github.com/nickgran321/Nick-Grant/blob/master/Physical%20Computing%20Week%204:%20Flex%20Sensor
For the next part of my lab, I opted to use a potentiometer as my variable resistor. I found the flex sensor to be too finicky and often times the object would not stay in my breadboard. In my demonstration, the bottom pin of the potentiometer is connected to the black control wire of my servomoter. The red wire is connected to power and the yellow wire is connected to digital input 9. I used header pins in order to plug the servomotor effectively into my breadboard.
Code on Github: https://github.com/nickgran321/Nick-Grant/blob/master/Physical%20Computing%20Week%204:%20Servo%20Motor%20Control
When I began to think about the creative abilities of a servometer, I visited the junk shelf for inspiration. I found a wooden circle and markers. I immediately began to view the servomoter as a clock dial. I would think of an hour and carefully change the dial with my potentiometer. In contrast to a digital input that changes from only one state to the next, an analog input shows a range of options. In the future, I would like to design a project in which students control a giant clock with a potentiometer. A time would appear on a monitor and the users would have to move the dials of the clock as soon as possible to match the time. There would be several levels and the users would need to beat all of them within a limited period of time.
In the next lab, I connected a potentiometer to my speaker. The middle pin of my potentiometer is connected to A0 for my analogRead. Both the top and bottom pins of my potentiometer are connected to ground. The positive wire of my speaker is connected to a 220-ohm resistor that is connected to ground. The blue wire is connected to pin 9 of my Arduino Nano, which is connected to the negative wire of my speaker. The frequency ranged from 0 to 1023. I wonder how I may construct music with multiple speakers.
Code on Github: https://github.com/nickgran321/Nick-Grant/blob/master/Physical%20Computing%20Week%204:%20Potentiometer%20and%20Speaker
I downloaded a Super Mario theme, which I successfully played on my speaker. I only needed to change a few pin numbers in my Arduino code.
Link to the code: https://www.hackster.io/jrance/super-mario-theme-song-w-piezo-buzzer-and-arduino-1cc2e4
Lastly, I tried soldering for the first time with a potentiometer. I found soldering to be a lot easier than I imagined. Each wire is inserted into a hole. I am excited to see what possibilities I will be able to create at ITP.