Arduino – Photoresistor (Light Sensor)

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:

#define lightSensor A5

void setup() {
  Serial.begin(9600);
}

void loop() {
  int lightLevel = analogRead(lightSensor);
  Serial.println(lightLevel);
  delay(1000);
}

Be the first to comment

Leave a Reply