ad timer into a loop

Hi guys,
I'm looking to include a timer that reset itself when a button is press into an existing loop.

I've made a photobooth that take a picture every time someone push a button. But my camera turn itself into standby mode every 15 minute if no action is made. So I have to force it to take a picture if no picture is take for more than 14 minutes.

The timer will trigger an output (output on pin 11) if 15minutes have pass since the last time the bouton (input on pin 10) is press.

Thanks!

Sounds simple, let's see your code.
HowToPostCode

You could use the millis() function to time how long the camera has been on for. To do this you would need to declare an unsigned long variable to hold the millis() number when your camera was triggered. Note that the millis() function returns the number of milliseconds since the arduino started running. This would result in something like this:

unsigned long lastButtonTime;
void loop(){
if(buttonPressed){
   lastButtonTime = millis(); 
}
if(millis()-lastButtonTime > 14*60*1000){ // 14 minutes in milliseconds
   takePicture();
   lastButtonTime = millis();
}
}
void loop(){
  
   // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  if (buttonState == HIGH) {

  // ********** photo #1
countd5();
    D5000.shutterNow();
  delay(pause2);  
  // ********** photo #2
countd3();
    D5000.shutterNow();
   delay(pause2);   
  // *********** photo #3
countd3();
  D5000.shutterNow();
   delay(pause2);  
  }
}

@Niek_now:

Is your line

if(millis()-lastButtonTime > 14601000){ // 14 minutes in milliseconds
takePicture();
lastButtonTime = millis();

can run in background. I want the program to keep waiting for the button to be push.

can run in background.

The Arduino doesn't have a "background", so no.

The code IS non-blocking, though, so it will be checking for other things, too, like "take a snapshot" switch presses.

Niek_Now:
You could use the millis() function to time how long the camera has been on for. To do this you would need to declare an unsigned long variable to hold the millis() number when your camera was triggered. Note that the millis() function returns the number of milliseconds since the arduino started running. This would result in something like this:

unsigned long lastButtonTime;

void loop(){
if(buttonPressed){
  lastButtonTime = millis();
}
if(millis()-lastButtonTime > 14601000){ // 14 minutes in milliseconds
  takePicture();
  lastButtonTime = millis();
}
}

It keep saying me that 'value required as left operand of assignement' as an error on my second if command..

If you have put new code together that produces that error, you need to post the updated code because we can't guess what it looks like.

By the way

if(millis()-lastButtonTime > 14*60*1000){ // 14 minutes in milliseconds

will not work because the expression 14601000 will overflow an int.

When I guess about the stuff that was missing from your snippet, the code you posted compiles for me.

I suggest that you take your snippets to http://snippets-r-us.com for help with your incorrectly paraphrased error message.