need help to make program for rely control

Hi .. i am new in Programming i need help to make a program that control the 3 relays on different timings the sequence are Relay 1, Relay 2, Relay 3

  1. Relay 1 and Relay 2 "on" and "off " for 5 sec like a flip flop this operation continue for 15 min 2 after turning off these two relays just turn on the Relay 3 and relay 1 without any "on" "off" function for 10 mints. 3.. Then program terminate...

Plz help me i need to make this program but don't understand how to do...

(deleted)

Use millis() to capture the time every pass thru loop, and compare it to the time you want to stop the current action, and start the next action.

// declare variables, add setup code.
// all time related variables must be unsigned long

// now the fun part:
void loop(){
currentTime = millis();
elapsedTime1 = currentTime - next5secTime;
elapsedTime2 = currentTime - 15minTime; //
if (elapsedTime1 >=5secondTime){
next5secTime = next5secTime + 5secondTime; // 5secondTime = 5 * 1000. 5000UL
// relay control code
}
if (elapsedTime2 >= 15minTime){ // 15minTime = 15 * 60 * 1000, also UL (unsigned long)
// add relay control code
while(1); // sit here until reset
}

} // end loop

Read & understand Blink without delay, this is 2 timers running at once.

Thank you very much CrossRoads...

spycatcher2k i think you are here to make fun of others.. if you don't have answer or don't want help others then don't waste your time..... just earn $$$$$$$$$$

Thanks again CrossRoads for your help. :)

(deleted)

its oK spycatcher2k may i don't understand your meaning thanks for clear...

sir.. i am very beginning i am in first semester of Computer engg i have lot of interest in making projects i want to use this circuit in my home i have arduino UNO. ATmega 8 i try very much in that logic which you send me but i did not reach to anything in every try i got error plz help me ..

i made this code like...

unsigned long currentTime=0; unsigned long elapsedTime1; unsigned long elapsedTime2; unsigned long next5secTime=5000; lunsigned long 5secondTime=5000; unsigned long 15minTime=900000;

void setup() {

pinMode(13, OUTPUT); pinMode(12, OUTPUT); pinMode(11, OUTPUT); } void loop(){ currentTime = millis(); elapsedTime1 = currentTime - next5secTime; elapsedTime2 = currentTime - 15minTime; // if (elapsedTime1 >=5secondTime){ next5secTime = next5secTime + 5secondTime; L

}

if (elapsedTime2 >= 15minTime) { while(1); }

how to get output to these pins?

You need to write to them. Please use code tags, and make sure your sketch has enough closing braces.

unsigned long currentTime=0;
unsigned long  elapsedTime1;
unsigned long  elapsedTime2;
unsigned long next5secTime=5000;
lunsigned long  5secondTime=5000;
unsigned long  15minTime=900000;
void setup() {                
  pinMode(13, OUTPUT);  
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);  
} 
void loop(){
currentTime = millis();
elapsedTime1 = currentTime - next5secTime;
elapsedTime2 = currentTime - 15minTime; //
if (elapsedTime1 >=5secondTime){
next5secTime = next5secTime + 5secondTime; L
}
if (elapsedTime2 >= 15minTime)
{
while(1);
}

sorry first experience in Arduino forum...

elapsedTime1 = currentTime - next5secTime;

Is a time in the past,.

Edit: or the very distant future.

i realy don’t understand the logic of this code … :~

i think i use LED's instead of relay then that's the batter way to understand what i want total three LED's RED,Green and YELLOW

1.RED led on for 5sec then "off" Green LED on for 5sec then "off" again same and run this operation continuously for 15min 2.After 15 min RED and Green led turn off and just ON permanently RED and Yellow LED for 10min after 10min RED and Yellow will turn off.

AWOL: elapsedTime1 = currentTime - next5secTime;

Is a time in the past,.

Edit: or the very distant future.

I think its future