Light Dependent Resistor


Light Sensor

An LDR is a resistor that varies resistance with the amount of light shining on it. The GL5537 changes resistance from 2000 kOhms in darkness to around 20 Ohms when lots of light shines on it.

Connect as follows:

10k Resistor Sensor Espruino
1st pin 3.3v
1st Pin 2nd pin A1
2nd Pin GND

Note: any Analog pin will do.

You can then easily read the analog value. Because of the way the sensor is wired, the value you'll get will be near 0.5 in darkness, and 1 when there is a lot of light.

var light = analogRead(A1);



This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.