/* Photocell simple testing sketch. 
 
Connect one end of the photocell to 5V, the other end to Analog 0.
Then connect one end of a 10K resistor from Analog 0 to ground 
Connect LED from pin 11 through a resistor to ground 
For more information see http://learn.adafruit.com/photocells */
 
int photocellPin = 0;     // the cell and 10K pulldown are connected to a0
int photocellReading;     // the analog reading from the sensor divider
int LEDbrightness;        // 
int outPin = 13;
int outPin1 = 14;
void setup(void) {
  // We'll send debugging information via the Serial monitor
    
   pinMode(outPin, OUTPUT);
   Serial.begin(9600); 
}
 
void loop(void) {
  photocellReading = analogRead(photocellPin);  
 
 
  {
  if(photocellReading<(1000))
  
      digitalWrite(outPin, HIGH);
      delay(300000);
      /* 300000   = 5 min */
      digitalWrite(outPin, LOW);
      delay(1000000);
      /* 900000 = 15min */

 }
 
 
  Serial.print("Analog reading = ");
  Serial.println(photocellReading);     // the raw analog reading
 
  // LED gets brighter the darker it is at the sensor
  // that means we have to -invert- the reading from 0-1023 back to 1023-0
  photocellReading = 1023 - photocellReading;
  //now we have to map 0-1023 to 0-255 since thats the range analogWrite uses
  LEDbrightness = map(photocellReading, 0, 1023, 0, 255);

 
  delay(100);
}

