Troubles with my IR code again

Hi everybody I was trying to control an relay with a TV remote but it seems to not be working.
It was supposed to when I press one of the button on my remote the relay turn on and when I press another it should turn it off.
But the relay turns it self on and dont obeys to the code.
Whats wrong can some one tell me pls I would appreciate.
Pedro Bessa

#include <IRremote.h>

#define RELAY_ON 0
#define RELAY_OFF 1

int RECV_PIN = 11;
#define Relay_1 2

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
  digitalWrite(Relay_1, RELAY_OFF);
  pinMode(Relay_1, OUTPUT);

void loop()
  if (irrecv.decode(&results))
    if (results.value==0x83789A2C){
      digitalWrite(Relay_1, RELAY_ON);
    if (results.value==0x9BF541C6){
      digitalWrite(Relay_1, RELAY_OFF);

So does the relay turn itself on without your input?

The only thing that stood out to me was that in your setup, your write a low to the relay before you set it as an output.

Are you sure those are the correct values it receives in the loop?

Test the relay withour the IR first.

Relay need special wiring to work with Arduino or any digital signal....How have you wired up the relay?
(If this is wrong you could damage your Arduino)

Please post the model nos/ links to data sheets for the IR receiver & relay, if available.

Yes the relay turn itself on without an input from me.

My 1-Channel Relay Board is a SRD-05VDC-SL-C it came with the kit that I bought.

The VCC of the relay is in series with the VCC of the IR receiver.
The INI pin of the relay is connected on pin 2 of Arduino.
The GROUND is coneected to Ground.
The OUT pin of the IR receiver is connected to pin 11 on Arduino.

I tested my relay with a basic code for Relays an it work.
Now that a modified the code to work with IR it refuses to work

Is it just the relay you are using or does it come on a board with components (Photo?)

I did a search and both are available on line.

just noticed...

Put the pinMode before the digitalWrite in your setup function

I keep running in to a problem that is :

-The Relay should be turn off when I start the code but it turns on by himself.
-He doesn't obey to the signal that's receiving from the remote.

An Image of the Relay goes attached.

The Image was too large so I couldn´t upload it.

But is a Relay with several components on Board

So resize the image and attach it again. ~1000 wide works well for viewing here.

or even better...a link to the image.

Did you make the changes to pinMode as suggested?

Yes I did make the changes but they didn´t work,

Heres a picture of the relay on my site
The link above from one of the regular contributors here may be of some help.

I also noticed that you do not use irrecv.resume, like in the example provided with the library, so you will never get a 2nd IR signal.

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value

Thanks that was the error

Pedro Bessa