Step 1: Analog Input Lab
The first lab involved wiring 2 analog sensors to the Arduino. The light sensor is set up using a second light sensor connected to ground to create a voltage-difference that can be measured by the analog input pins. The potentiometer has a specific pin for input and thus does not need a pull-down resistor. Each analog input value is mapped to the correct output values (0 to 255) and sent to the LEDs through the PWM pins using analogWrite().
You can click on the photos to get a lightbox/larger view!
Step 2: Analog Output Lab
The second part of the lab was hooking up the speaker and learning to use the tone() function. The speaker has a small resistor on it to protect it, and then goes straight into ground. The other end of the speaker is connected to an PWM port to send an analog output signal to it.
Step 3: Sensor Box
The next part of the lab was to combine all of this into a sensor box with two analog inputs and at least one analog output. For my inputs, I wanted to use a tilt sensor, but unfortunately it had a pretty binary value despite technically being an analog input. Same thing with a distance sensor, it is technically a digital input even though it has non-binary values. I ended up choosing a potentiometer, because it is very predictable and easy to understand, and a bend sensor. For my outputs I used a speaker and a strip of Neopixels.
Designing the interaction I wanted to mimmick a sort of bass “drop” or at least the build up to it. That involved changing the pitch gradually using the potentiometer, and then changing the BPM gradually using the bend sensor. The neopixels demonstrate both interactions, blinking to show BPM and changing color to indicate pitch.