The Use of Light Sensor
From Microduino Wiki
Revision as of 06:24, 4 November 2015 by 1304410487@qq.com (talk)
ContentsOutlineMicroduino-Light adopts photosensitive resistor. It uses a resistor that is based on semiconductor's photoelectric effect and is able to change along with the intensity of t the incident light. The photosensitive resistor is generally applied in light measurement, light control and photoelectric conversion. Specification
DevelopmentEquipment
Preparation
Experiment: Detect analog Brightness Value
#define sensorPin A0
int state;
void setup()
{
pinMode(sensorPin, INPUT);
Serial.begin(9600);
}
void loop()
{
state = analogRead(sensorPin);
Serial.print("state:");
Serial.println(state);
delay(100);
}
After the download, you can open the serial monitor. The displayed value reflects the current light intensity.
The stronger the light is, the greater the output value becomes. Therefore, you can build some projects controlled by light intensity change. Program Debugging
Application
Video |