- Goal of the project and/or desired interaction
This week our homework was to either create a circuit to light up a LED or control a Processing sketch using both a photocell sensor and an ultrasonic sensor. I decided to create a circuit to light up a LED. The criteria include having the LED not light up by itself when the photocell is exposed to light. If the environment is dark but the distance is close, LED will light up. If the distance is far away, the LED won’t light up. - Quick description of assembly and list of core components
1x Arduino1x Medium breadboard.1x White LED
1x Ultrasonic sensor
1x Photocell
1x Resistors (220 ohms) – resistor
1x Resistors (10K ohms) – photocell
Jump wires
- How it works
By itself, the LED will not light up when your hands are not influencing the photocell and the ultrasonic sensor. When your hands cover the photocell which indicates the environment is dark, but your hand is far away, the light will stay off. It’s only when your hand is near and covering the photocell, the light will light up. I used simple if statements with && to make the code part work. - Any problems you encountered and/or solved
I had to write down and think through my if statements and else statements clearly to get it right. At first, I kept on getting mixed up on my clauses. - Images of your circuit
- Arduino Code
https://github.com/lynnn43/PhysicalComputing/tree/master/wk5_photocell_ultratronicsensor_hwk5