Difference between revisions of "The Use of Light Sensor"
From Microduino Wiki
Line 64: | Line 64: | ||
</source> | </source> | ||
* Select the right board from Tools→Serial Port in Arduino IDE and download the program. [[file:upload.JPG|500px|center]] | * Select the right board from Tools→Serial Port in Arduino IDE and download the program. [[file:upload.JPG|500px|center]] | ||
− | * | + | *After the download, you can open the serial monitor. The displayed value reflects the current light intensity. |
− | After the download, you can open the serial monitor. The displayed value reflects the current light intensity. | ||
[[file:mCookie-pir-res.JPG|500px|center]] | [[file:mCookie-pir-res.JPG|500px|center]] | ||
*Result | *Result |
Revision as of 06:58, 4 November 2015
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);
}
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 |