Datasheet
In this case, our 'bucket' is a 0.1uF ceramic capacitor. You can change the capacitor nearly any way you want but the
timing values will also change. 0.1uF seems to be an OK place to start for these photocells. If you want to measure
brighter ranges, use a 1uF capacitor. If you want to measure darker ranges, go down to 0.01uF.
/* Photocell simple testing sketch.
Connect one end of photocell to power, the other end to pin 2.
Then connect one end of a 0.1uF capacitor from pin 2 to ground
For more information see http://learn.adafruit.com/photocells */
int photocellPin = 2; // the LDR and cap are connected to pin2
int photocellReading; // the digital reading
int ledPin = 13; // you can just use the 'built in' LED
void setup(void) {
// We'll send debugging information via the Serial monitor
Serial.begin(9600);
pinMode(ledPin, OUTPUT); // have an LED for output
}
© Adafruit Industries https://learn.adafruit.com/photocells Page 18 of 25










