Analog Input and Output  - GitHub Gist Code
A potentiometer was paired with an LED light, and a photoreceptor was paired with another LED light in order to demonstrate  variable input and output. The brightness of the LEDs were controlled by the serial values from the two analog inputs, which were then mapped to the output of the LEDs to brighten them or darken them appropriately. These values had to be re-mapped because analog input values range from 0 to 1023, while analog output values from a digital pin through Pulse Width Modulation only have a range of 0 to 255. 
Tone Output - GitHub Gist Code
Two variable resistors were used to manipulate the tone output of an 8-bit speaker. The frequency was mapped to the input values of the photoreceptor. This differs from the analog output of an LED because frequency has a range from 100 to 1000, which changes the pitch depending on how high or low the frequency is. 
Analog Input and Output Enclosure - GitHub Gist Code
My roommate has a crippling addiction to soda, which was the main inspiration for Daniel Reardon's and my enclosure. We chose to make a "Soda Can Prison" that would require whoever desires the soda to pay a quarter to fuel their cravings. The act of pushing a quarter through a slot blocks a photoreceptor on the opposite side of a bright white Neopixel. The sudden change in light intensity is what triggers the servo motors to open the cell door. Two Neopixels, one red, one green, also help indicate that the door is unlocked or locked. The servos utilize analog output via control of the degrees that the servos spin to open the door. The other analog input comes from a potentiometer hidden on the back of the enclosure. The potentiometer has two slots that a laser-cut key can slip into to turn the potentiometer. When the potentiometer reading passes 900, the cell door is unlocked. This allows for me to easily access soda at no extra charge, or to refill the empty spot after my roommate succumbs to his desires.
Edges 2 Cats
Zack mentioned in class that we could get one extra point on our lab if we included a section about edges2cats, so here we are:
Back to Top