-
Notifications
You must be signed in to change notification settings - Fork 9
Part 3. Light Sensor
Rachel edited this page Jul 21, 2015
·
1 revision
The light sensor couldn't be easier to read from. The number it gives us is the ambient light level in Lux. You can test it with the sketch here:
https://github.com/InitialState/arduinosensorbox/blob/master/lighttest.ino
void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(0);
Serial.print("The light level is ");
Serial.println(sensorValue);
delay(1000);
}
Running this script will print the light level to the serial monitor. Try covering and uncovering the sensor to see how the light value changes. A good list of typical light levels for different environments can be found here: http://www.engineeringtoolbox.com/light-level-rooms-d_708.html
Now that we know all three sensors are working, we can move on to reading them all at once!
<< Part 3: PIR Motion Sensor - Part 4: Putting it All Together >>