Photoresistors are analog sensors that allow your Arduino to determine the level of light in an environment.
Note: You can use either 5 or 3.3 volt power for this project, and you can use different values of resistors (4.7K or 10K). Just remember that using different resistors or voltage will change the value the sensor outputs.
Functional Parts in the Project:
- Arduino Uno – https://store.arduino.cc/usa/arduino-uno-rev3
- 560 Piece Jumper Wire Kit – https://amzn.to/2MsCLjL
- 220 Ohm Resistors – https://amzn.to/2RiiMD9
- Breadboard Kit – https://amzn.to/2Xih5ei
- Photoresistor – https://amzn.to/2lfakbA
#define lightSensor A5
void setup() {
Serial.begin(9600);
}
void loop() {
int lightLevel = analogRead(lightSensor);
Serial.println(lightLevel);
delay(1000);
}
Be the first to comment