1. Outcome
The final work I completed combines input from a photocell sensor as well a button. To complete this, I wired the two inputs/sensors separately and used a digital and analog pin for each. Here is a demonstration of the wiring:
The process of developing is was quite straight forward: I first only added one sensor (the photosensor). At first the brightness didn't change a lot, and after some thinking, I found that changing the input range of the map function to be smaller will make the brightness change more noticeable. After I got this system working, I added a button as a second input, and revised the code to include the button state.
Reflection:
I definitely became a lot more familiar with how to connect input, and make dynamic changes to the system using if statements. I enjoyed this lab because often, the IoTs in daily lives will involve at least one user inputs. One improvement I'd make is perhaps making the brightness of the LED increase (instead of decrease which is what I have done) when it is darker, because that would make more sense in real life.
You can upload files of up to 20MB using this form.