Hi,
I am very new to the Arduino community and have been working on my first project:
A laser beam is broken and the LDR "senses" that the light level has dropped below my specified value in the code. If the beam is broken, 3 pins go high that are connected to the shutter cable of my camera which in turn triggers the camera.
My question is: How do I set the 3 pins [pins 8,9,10 (digital pins btw.)] to HIGH for a specific amount of time for all 3 pins at the same time? e.g. beam is broken, pins 8, 9, and 10 go High for 10 seconds?
Thank you!
My code thus far looks like this:
int LDR = 0;
int LDRValue = 0;
int Light_sensitivity = 350; //set the sensitivity threshhold of the LDR, lower values = less light//
void setup()
{
Serial.begin(9600);
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
}
void loop()
{
LDRValue = analogRead(LDR); //the LDR is connected to an analog pin A0//
Serial.println(LDRValue); //this command allows you to "print" the light level using the serial monitor under the tools tab//
delay(100); //this is the delay in ms that the serial monitor updates the light level//
if(LDRValue < Light_sensitivity) //if light sensitivity falls below the value of X [as defined in line 3 (lase on LDR is about 900)] trigger occurs (8,9,10 are high)//
{
digitalWrite(13, HIGH); //13 is for the laser//
digitalWrite(8, HIGH); //8 is for the camera trigger//
digitalWrite(9, HIGH); //9 is for the camera trigger//
digitalWrite(10, HIGH); //10 is for the camera trigger//
}
else
{
digitalWrite(8, LOW); //when laser is on the LDR, No trigger occurs//
digitalWrite(9, LOW); //when laser is on the LDR, No trigger occurs//
digitalWrite(10, LOW); //when laser is on the LDR, No trigger occurs//
} }