Greetings,
Dears I Hope you are in Good Health,
I'm Using Arduino UNO, This is My Project:
Motion Detector(PIR)
Relay
IR Remote
this is how it work
if Motion Detected Turn on the Relay, when IR Remote Received the Signal it Will Turn off the Relay
THIS IS MY PROBLEM
when i Upload the code it will work Normally, but when i unplug the the power and plugged in again, the Relay will Turn on ![]()
can any one Help me Please to make relay off when plugged to power source.
Thanks in Advance.....
#include <IRremote.h>
int MP_Sensor=3; //Define PIR
int MP_Notification=4; //Define Relay
int MP_IR = 6; //Define IR Remote
IRrecv irrecv(MP_IR);
decode_results results;
#define BUTTON_0 0x9716BE3F
void setup() {
Serial.begin(9600);
pinMode(MP_Sensor, INPUT);
pinMode(MP_Notification, OUTPUT);
pinMode(MP_IR, INPUT);
digitalWrite(MP_Notification, HIGH); //Make Relay off at Start
irrecv.enableIRIn();
}
void loop() {
if(digitalRead(3) == HIGH)
{
digitalWrite(4, LOW);
}
if (irrecv.decode(&results))
{
if (results.value == BUTTON_0)
{
digitalWrite(4, HIGH);
}
irrecv.resume();
}
}