Sketch for remote shutter

From XPUB & Lens-Based wiki
#include <Servo.h>

Servo myservo;
int val;         //variable for sensor value's
int thresh = 629;      //threshold LDR
int pos = 0;  //rest position

void setup()
{
  myservo.attach(8);  // attaches the servo on pin 9 to the servo object
  Serial.begin(9600);
  
}

void loop()
{

val = analogRead(0);
 Serial.println(val);
myservo.write(0); //write rest position

if (val > thresh){                //compare threshold to sensor value
myservo.write(30);                //move servo to position given by the amount of light 
delay(1000);
myservo.write(0);
delay(1000);
myservo.detach();

}

}