/* Turn LED on based on analogue input from LDR (photocell) Threshold depends on the light in room Jentery Sayers Written on March 29 */ int lightPin = 0; // lightPin is our actuator; int threshold = 250; // defining threshold of light based on room void setup () { Serial.begin(9600); pinMode (13,OUTPUT); // tell Arduino that 13 is for Output (to LED) } void loop() { Serial.println(analogRead(lightPin)); if(analogRead(lightPin) > threshold) { digitalWrite (13,HIGH); Serial.println("why hello there"); delay(10); } else { digitalWrite(13,LOW); Serial.println("you seem so far away"); delay(2000); } }