Relay Control

I am a complete novice desperately trying!! I would like to write a program to control relays with independent preset timings.

Relay 1 //on and off at settable times Relay 2 //on and off at settable times Relay 3 //on and off at settable times

eg. Relay 3 can be preset to go on when Relay 1 is on and Relay 2 is off, etc

Can anyone give me a few lines of program in the right direction?

Many Thanks in advance

You need to work out exactly what you want. The list of your requirements does not sit well with your example

Relay 3 can be preset to go on when Relay 1 is on and Relay 2 is off, etc

It seems to contradict what you said earlier. Is their an application here or is it an assignment?

My poor explanation !! I,ts just for me to try and learn some simple programing I have played about with delay etc

The task I have set myself is

Relay 1 Able to be switched on and off with preset times for on and for off. Relay 2 As above.

eg Relay 1 and Relay 2s timed periods to be adjustable thro each others timed period Relay 1 and 2 on and of at the same time or 1 on, and 2 on half way thro time period and both off together

Hope that makes it a bit clearer!

First you have to define "time". Does it go on at a specific time of day or is this just a 3-minute egg timer?

For time-of-day, you must have a Real Time Clock, often abbreviated RTC. Buy a module online and experiment with it, just making some LEDs turn on and off first.

For elapsed time up to 24 hours or so, use the built-in millis() timer. This is only accurate to 3% but often that's good enough.

Seems you want a state machine See my Or Robin2's several things at once