Relay Shield v2.1

Good morning,

I am first time user of a Relay Shield for Arduino V2.1 , code: DFR0144, and I have a technical question to ask.

Any time I connect the shield on the Arduino UNO the pin13 LED stays ON all the time, with out pushing the Push Button.

Am I doing something wrong?

See photo.

Please note that without the shield the program is working fine.

See code:

  int PushButton= 8;
  int LedLight=13;

 void setup() {

 pinMode(PushButton, INPUT);
 pinMode(LedLight, OUTPUT);
digitalWrite(PushButton, HIGH);
 }

 void loop() {

 if (digitalRead(PushButton)==LOW) {


digitalWrite(LedLight, HIGH);

delay(5000);

}

else
digitalWrite(LedLight, LOW);

}

Kind Regards,
Marios Elia

Hi Marios,

I don’t see anything on the datasheet that would keep pin 13 HIGH. You could try changing pinMode(PushButton, INPUT); to pinMode(PushButton, INPUT_PULLUP); just to make sure there are no floating voltages when you aren’t pushing the button, but other than that your code looks fine.

If that doesn’t fix it, we might need to look at the shield itself.

Thanks Josh for your assistance, but unfortunately did not solve the problem. See image as well
IMG_8232|666x500

I can’t think of anything you’ve done wrong, so it sounds like there might be a problem with the board. If you reply to your order confirmation email with a link to this forum post, the support team can take it from there.

Hi Marios

I tested your board first by wiring it in the way you have shown. I changed your code to what I have below and by removing the jumper indicated on the picture. Doing this I was able to get the desired behaviour. Someone will be in contact shortly to arrange returning the device to you.

int PushButton= 7;
int LedLight=13;

void setup() {
  pinMode(PushButton, INPUT_PULLUP);
  pinMode(LedLight, OUTPUT);
  //digitalWrite(PushButton, HIGH); Does same job as INPUT_PULLUP
}

void loop() {
  if(digitalRead(PushButton) == LOW) {
digitalWrite(LedLight, HIGH);
delay(50);
  } else{
digitalWrite(LedLight, LOW);
  }
}

Thank you very much for your assistance.

I would like to order another shield as well, so if someone can contact me ,will be good.

Not a problem Marios - I’ll give you a call this afternoon to arrange sending your order back out and picking up another.