Let me clear that i'm new to programming after reading Arduino projects i found it very interesting.
I want know whether is their any option to check defined event is happen or not in defined time limit when Arduino start.
For example: one pump is connected to Arduino,when Arduino start, pump will start and Arduino need to check whether pump has reached to minimum defined pressure with 1min or not. if not interrupt will arise.
If your Arduino has the hardware to start the pump and to measure the pressure, then your Arduino code can measure the time and take action. The word interrupt has a specific meaning that I do not think that you intended here.
There are thousands of C++ tutorials online. Just use your favorite search engine (such as Google or Bing).
You may want to look up Finite State Machines (FSM) as well so that you can avoid delay(60000UL).
The Arduino IDE comes with examples that you may want to try first. The Arduino web site also has reference material for things that were added to make Arduino easier to use.
Instead of using delay(...), I suggest that you look at "Demonstration code for several things at the same time" http://forum.arduino.cc/index.php?topic=223286.0
This will allow you to do other things (like check a CANCEL button) while you are waiting for the one minute to elapse.
Please note that it is likely to damage your Arduino if you try to run a pump directly from it. You probably need a relay or motor driver shield.
If you use a relay, please be aware of the back EMF from the relay coil which can INSTANTLY destroy your Arduino when the relay current is turned off. Please use a relay shield or at least a properly rated diode across the relay coil.
I will do the wiring of relay with arduino board as you said.
I didn't found any tutorial on internet where i can get idea how to check whether set event on time is met or not.
Sorry for trouble .
if possible can you write any small code example how it can be done.
for example : To check whether LED is glowing or not in 2sec time duration once arduino start,if LED not glowing,then on serial monitor arduino will show message LED off.
please do if you have time ...if you can't then also its fine dear.
Thanks for bearing me.if know any link for such example that is also fine for me.
god bless you .
i am 52 year old man but i am still searching on net for tutorial but didn't found that .
for example : To check whether LED is glowing or not in 2sec time duration once arduino start,if LED not glowing,then on serial monitor arduino will show message LED off.
because you did not explain how to check that an LED is glowing.
I will provide a pump example in a following post.
The pump is controlled by pin 7, and that a HIGH turns the pump on and a LOW turns the pump off.
The pressure is sensed by something connected to pin 6, and that a HIGH means there is sufficient pump pressure and a LOW means that the pressure is too low.
This example is UNTESTED and provided WITHOUT WARRANTY and WITHOUT COST.
I was thinking of something like this:
#include "Arduino.h"
// Set the proper pin numbers.
const byte pressure = 6 ;
const byte pump = 7 ;
enum State { on, sufficientPressure, lowPressure };
State pumpState ;
unsigned long currentTime ;
unsigned long startTime ;
const unsigned long waitTime = 60000UL ; // 60000 milliseconds equals 60 seconds equals 1 minute.
void setup() {
pinMode(pressure, INPUT) ;
pinMode(pump, OUTPUT) ;
digitalWrite(pump, HIGH) ;
pumpState = on ;
startTime = millis() ;
}
void loop() {
const unsigned long currentTime = millis() ;
switch (pumpState) {
case on:
if ((currentTime - startTime) >= waitTime) {
if (digitalRead(pressure)) {
pumpState = sufficientPressure ;
} else {
pumpState = lowPressure ;
}
}
break ;
case sufficientPressure:
break ;
case lowPressure:
digitalWrite(pump, LOW) ;
break ;
default:
pumpState = lowPressure ;
break ;
}
}
I'd think that you better start with learning the basics. Have a look at the many examples in the IDE, how to handle specific tasks. Play around with the example code, until you got the essential picture for handling each task. In detail the "several things at the same time" thread on the top of this forum will give insight in the concurrent handling of events.