I have written a program to control a relay but the problem is whenever I power on the Arduino, the relay synchronously connects for a very short time then it disconnects. I want the relay only connects when the condition is satisfied, yet not every time I power the Arduino.
My code:
void setup()
{
//part of the code here not related to relay
pinMode(10,OUTPUT);
}
void loop()
{
digitalWrite(10,HIGH);
//an if statement exists here that executes the following lines if it is satisfied
digitalWrite(10,LOW);
delay(1200);
digitalWrite(10,HIGH);
}