Hi,
I am after some help. My setup wired like the one below.
My code is supposed to delay 5 seconds, turn the relay on for 10 seconds, then turn the relay off when it receives a LOW input on pin 4. The problem is that the relay sequence is constantly looping.
My code is below, along with the wiring setup. PLEASE HELP ME!!!
int val = 0;
int switchPin = 4;
int relayPin = 7;
void setup() {
pinMode(switchPin, INPUT_PULLUP);
pinMode(relayPin, OUTPUT);
digitalWrite(switchPin, HIGH);
}
void loop() {
digitalWrite(8, HIGH);
if (digitalRead(switchPin) == LOW);
{
delay(5000);
digitalWrite(relayPin, HIGH);
delay(10000)
digitalWrite(relayPin, LOW);
}
}
Also, pin 8 is for testing, and ignore 'val'
Moderator edit:
</mark> <mark>[code]</mark> <mark>
</mark> <mark>[/code]</mark> <mark>
tags added.
