How can i control 2 relay in different timings with arduino and pir sensor

How can i control 2 relay in different timings with arduino and PIR sensor
My Conditions
If PIR sense Relay R1 on for 3 times with 30sec on time
if PIR sense Relay R2 on for 1 time with 30sec on time

Did you see the title of the category in which you posted ?

DO NOT CREATE TOPICS IN THIS CATEGORY

Your post has been moved to the Project Guidance category which is where you should have posted it

thank you,

Hello lenu_kannan_photography

Post your sketch, well formated, with well-tempered comments and in so called code tags "< code >" and schematic to see how we can help.

Have a nice day and enjoy coding in C++.

int led = 13;

int sensor = 2;
int state = LOW;
int val = 0;

void setup() {

pinMode(3, OUTPUT); // Relay 2

pinMode(led, OUTPUT); // Relay 1
pinMode(sensor, INPUT);
Serial.begin(9600);
}

void loop()
{

val = digitalRead(sensor);
if (val == HIGH) {

digitalWrite(led, HIGH);
  
delay(50);  
 digitalWrite(led, LOW);
  
delay(100);






 


}

}

@lenu_kannan_photography
Do you never read advice given ?

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.