Create a Night Light
Last updated
Was this helpful?
Last updated
Was this helpful?
This is an example of using an input (sensor) component to change an output of an output component.
Circuit Board
Breadboard
Jumper Cables
Photoresistor
(light sensor)
Standalone LED Light
(any color with 2 leads)
100 Ohm Resistor
220 Ohm Resistor
The photoresistor data (yellow) is connected to pin A0 (analog) and the LED data (orange) is connected to pin 2 (digital).
This code gets the amount of light coming in via the sensor and if it's dark enough, the LED will light up.