Go Down

Topic: How to make a 15 min. pause ?? (Read 787 times) previous topic - next topic

Solow


Hi there..

Im new to arduino and have no programmingexperience whatsoever.. but still did manage to build a Aquariumcontroller which tells Temp, PH on a 4 line LCD, and with these variables turns on and off various equipment..

My new quest is to have it to make a 15 minutes pause on one of the output when i activate a inputpin, and my question is : is there a special way to do this or is it just to make an delay(900000) ?!?

Thanks
Martin

Grumpy_Mike

#1
Sep 08, 2008, 05:59 pm Last Edit: Sep 08, 2008, 05:59 pm by Grumpy_Mike Reason: 1
I would use the timer that records the number of seconds the Arduino has been on. Add 15 mins to it and keep checking to see if it has expired. In that way you don't hang (or block) the rest of the processes.

mem

#2
Sep 08, 2008, 06:44 pm Last Edit: Sep 08, 2008, 06:48 pm by mem Reason: 1
You may want to use the DateTime library in the playground to impliment mike's suggestion. Here is one example of how to use the library for something like this:

Code: [Select]


// this sketch makes pin 13 go high for 15 minutes from the time pin 2 goes low.
// once pin 13 is triggered on, the state of the input pin is ignored until the 15 minutes has elapsed and pin 13 is taken low again.

#include <DateTime.h>

void setup(){
pinMode(13,OUTPUT); // we turn the led on for 15 minutes from the time Pin 2 goes low
digitalWrite(13,LOW);  // LED off to start
}

#define TRIGGER_INACTIVE 0xffffffff  // a special value that indicates that no trigger is active.

unsigned long  endTrigger = TRIGGER_INACTIVE;
 
void  loop(){

 if( digitalRead(2) == HIGH){  // is the input switch pushed?
     if( endTrigger == TRIGGER_INACTIVE){  // only proceed if no trigger is active.  
       // trigger the led and store the time to turn off the led
        digitalWrite(13, HIGH);
        endTrigger = DateTime.now() + (15 * 60); // set trigger for 15 minutes from now  
             // note that DateTime.now() returns seconds since Arduino started
     }
 }
 if( DateTime.now() >= endTrigger ){
     // check if our trigger time has elapsed since last trigger  
     digitalWrite(13,LOW);
     endTrigger = TRIGGER_INACTIVE;
 }
}

Solow

 Thanks.. Ill try that out in the morning ;-)

startx

Hello,

I'm starting and I am very interested in your assembly, which compon :)ents as you used for your mounting PH assemble them and how?

;)

Solow

Quote
Hello,

I'm starting and I am very interested in your assembly, which compon :)ents as you used for your mounting PH assemble them and how?

;)


Hi there..

First... Thanks MEM, you helped me out again  ;)

For the PH probe i bought a new one on Ebay, and from the technical info i got on it, found out that it gave 0.60 Mv pr 0.1 ph so therefrom it was just a calculation and there you have it.. and AGAIN thanks to MEM i found out how to print decimals on my display so it looks right  :)

mem

Hi Martin, good to hear you have it going

Have fun!

Go Up