Project 1 - Switches and Analogs
My post will be a little light on fritzing pictures because somethings wrong with my installation. As a summary I attached a joystick (2 analog inputs) to control the brightness of two LEDs separately. The two LEDs are above a light sensor (1 more analog input) that detects the changes in brightness and uses that to turn either a red or a green LED on. For the digital inputs I used two buttons to control which one of a 4x4 grid of LEDs was on. Getting the analog circuit to work was mostly an exercise in sensor calibrating and value mapping. To get the Joystick to output a value from 0-255 instead of ~500 to 1023 in one direction and 0 to ~500 in the other took some creative math. I ended up taking the value of the joystick in the setup method and subtracting that then taking the absolute value and now the joystick increases the brightness no matter which direction you use it on. Getting the light sensor to detect the change from 2 LEDs was more of a pain. I had to take the value...