CONTROLLED FAN BY RCWL-0516

RCWL fun control

int ip = 2;
int val = 0;
int relay = 7;
void setup() {
Serial.begin(9600);
pinMode (ip, INPUT);
pinMode (relay, OUTPUT);
}
void loop() {
val = digitalRead(ip);
Serial.println(val, DEC);
if(val >0)
{
digitalWrite(relay, HIGH);
delay(300000); //once trigger come,relay will active 5 minute
}
else
{
digitalWrite(relay, LOW);
}

}