Go Down

Topic: My Relay seems broken? (Read 309 times) previous topic - next topic

creativen

I just bought a relay for Arduino and following the tutorial code here: http://www.dfrobot.com/wiki/index.php?title=Relay_Module_%28Arduino_Compatible%29_%28SKU:_DFR0017%29
Code: [Select]
//Arduino Sample Code
//www.DFRobot.com
//Last modified on 14th March 2012 by HJS
//This code has been updated to work with the sample code provided in the Wiki

int Relay = 3;
 
void setup()
{
  pinMode(13, OUTPUT);         //Set Pin13 as output
  digitalWrite(13, HIGH);     //Set Pin13 High
  pinMode(Relay, OUTPUT);     //Set Pin3 as output
}
void loop()
{
          digitalWrite(Relay, HIGH);   //Turn off relay
          delay(2000);
         
}


But it is only flashing the led and there is a click sound. What happen with my relay? broken?

retrolefty

#1
Jan 18, 2013, 07:05 pm Last Edit: Jan 18, 2013, 07:07 pm by retrolefty Reason: 1
Sounds like it's working to me. What do you expect it to do with that sketch code? The click sound is the relay turning on, take an ohm meter reading between the common and normally open relay contact and see if you have continuity, if you do that confirms your sketch is turning on the relay as your sketch is trying to do.

Most all those Asian relay boards are designed to turn on the relay with a digital LOW output and turn the relay off with a digital HIGH output. That is not a problem, just write your sketch knowing that fact.

Lefty

dc42

What do you expect it to do? Your code turns the relay on and leaves it on, therefore it should click once.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

PeterH


it is only flashing the led and there is a click sound.


It's flashing the LED? I wouldn't expect that.
I only provide help via the forum - please do not contact me for private consultancy.

creativen

I apology to all you because it seems my wrong to do the coding.
I forget that I put attach.servo(3); it means to the same pin with the relay, so it results in flashing, interesting.

Thank you for you kindness to response this post!

Go Up