Pages: [1]   Go Down
Author Topic: My Relay seems broken?  (Read 274 times)
0 Members and 1 Guest are viewing this topic.
universe
Offline Offline
Sr. Member
****
Karma: 0
Posts: 258
I'm enjoying my Life
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
//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?
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17292
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: January 18, 2013, 01:07:41 pm by retrolefty » Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6613
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What do you expect it to do? Your code turns the relay on and leaves it on, therefore it should click once.
Logged

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.

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12631
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

It's flashing the LED? I wouldn't expect that.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

universe
Offline Offline
Sr. Member
****
Karma: 0
Posts: 258
I'm enjoying my Life
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Pages: [1]   Go Up
Jump to: