In this project, Arduino will send the analog readings obtained from a Photo Resistor, also known as a Light Dependent Resistor (LDR), to the computer.
Parts required:
- PhotoCell (or PhotoResistor)
- 10K resistor
- Breadboard
- Arduino UNO
- 5 wires(to connect it all together)
/// Code to run in Arduino
int LED = 2; // LED on PWM pin
int LDR = 0; // analog pin light sensor
int brightness = 0;
void setup() {
pinMode(LED,OUTPUT);
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
LDR = analogRead(A0); // read value from sensor
Serial.println(LDR); // print out the value you read
analogWrite(LED, LDR/4); // assigning the LED sensor value to 1/4 of the LDR value
delay(1); // delay in between reads for stability
}
Arduino Light Sensor is a project of IaaC, Institute for Advanced Architecture of Catalonia developed at Master in Advanced Architecture in 2015 of the Academic Program by:
Student:
Lalin Keyvan
Faculty:
Carmen Aguilar
Ramin Shambayati