Im a noob
Trying to make program something.
I have tried many solutions, but if someone can help me that would be great.
This is what Im trying to do.
I have a Arduino and a 4 relay module.
What I want to have is that two of the relays stay on always
while the other flash every minute, so on and off.
Think airplane lights, that are on and flash on intervals.
I thought I could do this with two lights. One always on and the other light giving the effect of flashing.
Please help
#define RELAY_ON 0
#define RELAY_OFF 1
/-----( Declare objects )-----/
/-----( Declare Variables )-----/
#define Relay_1 7 // Arduino Digital I/O pin number
#define Relay_2 8
#define Relay_3 9
#define Relay_4 10
void setup() /****** SETUP: RUNS ONCE ******/
{
//-------( Initialize Pins so relays are inactive at reset)----
digitalWrite(Relay_1, RELAY_OFF);
digitalWrite(Relay_2, RELAY_OFF);
digitalWrite(Relay_3, RELAY_OFF);
digitalWrite(Relay_4, RELAY_OFF);
//---( THEN set pins as outputs )----
pinMode(Relay_1, OUTPUT);
pinMode(Relay_2, OUTPUT);
pinMode(Relay_3, OUTPUT);
pinMode(Relay_4, OUTPUT);
//Check that all relays are inactive at Reset
}//--(end setup )---
void loop() /****** LOOP: RUNS CONSTANTLY ******/
{
//---( Turn all 4 relays ON in sequence)---
digitalWrite(Relay_1, RELAY_ON);// set the Relay ON
delay(10000); // wait for a second
digitalWrite(Relay_2, RELAY_ON);// set the Relay ON
delay(50); // wait for a second
digitalWrite(Relay_3, RELAY_ON);// set the Relay ON
delay(10000); // wait for a second
digitalWrite(Relay_4, RELAY_ON);// set the Relay ON
delay(50); // wait see all relays ON
//---( Turn all 4 relays OFF in sequence)---
digitalWrite(Relay_1, RELAY_ON);// set the Relay OFF
// wait for a second
digitalWrite(Relay_2, RELAY_OFF);// set the Relay OFF
delay(5000); // wait for a second
digitalWrite(Relay_3, RELAY_ON);// set the Relay OFF
// wait for a second
digitalWrite(Relay_4, RELAY_OFF);// set the Relay OFF
delay(5000); // wait see all relays OFF
}//--(end main loop )---
//( THE END )**