Pages: [1]   Go Down
Author Topic: How to make a 15 min. pause ??  (Read 670 times)
0 Members and 1 Guest are viewing this topic.
Denmark
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


 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
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 603
Posts: 33408
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: September 08, 2008, 10:59:43 am by Grumpy_Mike » Logged

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6250
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:

// 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;
  }
}
« Last Edit: September 08, 2008, 11:48:25 am by mem » Logged

Denmark
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Full Member
***
Karma: 0
Posts: 144
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

 smiley-wink
Logged

Denmark
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

 smiley-wink

Hi there..

First... Thanks MEM, you helped me out again  smiley-wink

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  smiley
Logged

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6250
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Martin, good to hear you have it going

Have fun!
Logged

Pages: [1]   Go Up
Jump to: