Code for timing camera


int transistor = 8;

int sensor = A0;

int out= 3;

int trigger= 5;

int outRead1= 0;

int outRead2= 0;

int outRead3 =0;

boolean timing= 0;

 


void setup(){ 

pinMode (transistor, OUTPUT); 

pinMode (out, INPUT); 

pinMode(trigger, OUTPUT); 

pinMode(sensor, INPUT); 

pinMode(13, OUTPUT);        

   }

 


void loop(){  

 outRead1 = digitalRead(sensor);   

 outRead2 = digitalRead(out);   

 

if(outRead1== LOW){           

  digitalWrite (trigger, LOW);  } 

if(outRead1== HIGH && outRead2== LOW){//Sensor goes off


    digitalWrite (trigger, LOW);   

    delay(1000);   

   digitalWrite (trigger, HIGH);   

   digitalWrite (13, HIGH);

  }   

else if ( 13== HIGH){ //NE555 chip   

//Camera, with transistor 

   digitalWrite (trigger, HIGH);   

   timing = true;   

   digitalWrite (transistor, HIGH);   

   delay(1000);   

   digitalWrite (transistor, LOW); 

 
  }   

if (outRead3 ==LOW && timing== true){    

   digitalWrite(transistor, HIGH); //PICTURE  

//reset   digitalWrite(13, LOW);   

   digitalWrite(sensor, LOW); 

   digitalWrite(out, LOW);   

  digitalWrite (trigger, LOW);   

  delay(1000);   

  digitalWrite (transistor, LOW);   

}

}