In this lab assignment, I used two sensors (photo resistor and potentiometer) and one switch (button) to control a “ball” in Processing. I had difficulty getting it to work at first, but Jason helped me re-map each sensor. The photo resistor was only going up to about 16 so we mapped it 0-16. The potentiometer went up to 1023 so I re-mapped it to 0-1023. The result was interesting as you can see in the video while I interact with the different sensors. The potentiometer controlled the “Y” access (up + down) in smooth, predictable motions as the pot is easy to control. The photo cell is much less predictable and you can see how interacting with it controlling the “X access (left and right) produced really erratic motions.
Here is a photo my breadboard and Arduino setup:
