Infared Emulation-Help Still Needed

Yes, I am fully aware of the many, many tutorials on this subject. However, I am a noob at this so bear with my simple minded questions. That being said, here's the problem.

I am at trying to emulate a Sony Clock Radio remote. I couldn't find any documentation on the remote I am using (I was hopeful) so I made my own little decoder to decode and display what was being transmitted(what I wanted to emulate) and I got the following:

Value: 1766718754
Bits: 32
Result type: -1
Raw Length: 68

my code for this :

#include <IRremote.h>

int IRpin = 11;
IRrecv irrecv(IRpin);
decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn();
}

void loop() 
{
  if (irrecv.decode(&results)) 
    {
      Serial.print("Value: ");
      Serial.println(results.value); 
      Serial.print("Bits: ");
      Serial.println(results.bits);
      Serial.print("Result type: ");
      Serial.println(results.decode_type);
      Serial.print("Raw Length: ");
      Serial.println(results.rawlen);
      Serial.println("");
      irrecv.resume();   
    }
}

Now, with that out of the way and knowing the value sent as well as the number of bits, I made this to try to send the signal:

#include <IRremote.h>
#include <IRremoteInt.h>

IRsend irsend;

void setup(){
  Serial.begin(9600);
}
void loop(){
  if (Serial.read() == 'send'){
    irsend.sendSony(1766718754, 32);
    delay(500);
  }
}

I get this error when compiling :

IRremote\IRremote.cpp.o: In function MATCH(int, int)': /IRremoteInt.h:176: multiple definition of MATCH(int, int)'
sketch_sep06a.cpp.o:C:\Users\Jake2_000\Documents\Arduino\libraries\IRremote/IRremoteInt.h:176: first defined here
IRremote\IRremote.cpp.o: In function MATCH_MARK(int, int)': /IRremoteInt.h:177: multiple definition of MATCH_MARK(int, int)'
sketch_sep06a.cpp.o:C:\Users\Jake2_000\Documents\Arduino\libraries\IRremote/IRremoteInt.h:177: first defined here
IRremote\IRremote.cpp.o: In function MATCH_SPACE(int, int)': /IRremoteInt.h:178: multiple definition of MATCH_SPACE(int, int)'
sketch_sep06a.cpp.o:C:\Users\Jake2_000\Documents\Arduino\libraries\IRremote/IRremoteInt.h:178: first defined here

What? I have no inkling as to what this means. I used the irsend.sendSony(0xa90, 12); from the IRsendDemo. Just swapped in my results from my decoder. Now how do I fix this puzzling problem? :astonished:

Sorry, forgot to add that I tried the hex code "FE58A7" instead of "1766718754" and still got an error :

sketch_sep06a.ino: In function 'void loop()':
sketch_sep06a:11: error: 'FE58A7' was not declared in this scope

Which has me equally puzzled(I am very new)

If you could also keep the answer simple for me to understand that would be well appreciated, I like to learn, not just copy-paste.

Many thanks XD

  if (Serial.read() == 'send'){

Serial.read() returns one byte, not four. Plus, 'send' is not the same as "send".

Plus, you aren't testing if any serial data is available.

As for the error messages:

#include <IRremote.h>
#include <IRremoteInt.h>

Try not including both .h files.

Ok. I got it so that it can compile but sending is still a no-go.

I tried hex with both
irsend.sendSony(0x384BA081, 32);

irsend.sendNEC(0x384BA081, 32);

...but to no avail. If it's any help the remote is: Sony Clock Radio RMT-CCS10iP. The program itself does say it is sending a signal but even with the LED held less than a foot away from the sensor, the radio still refuses to respond.

BUMP
Still help needed, would very much appreciate any input. The program can compile, just not send a message. The LED itself is fine as I have checked it with IRecord.

RedStar:
Ok. I got it so that it can compile but sending is still a no-go.

I tried hex with both
irsend.sendSony(0x384BA081, 32);

irsend.sendNEC(0x384BA081, 32);

...but to no avail. If it's any help the remote is: Sony Clock Radio RMT-CCS10iP. The program itself does say it is sending a signal but even with the LED held less than a foot away from the sensor, the radio still refuses to respond.

Is "0x" supposed to be included in there like that?
Yes, it is...

Shirriff's example

shows that code is sent three times (three times in a row)
"This sketch sends a Sony TV power on/off code whenever a character is sent to the serial port, allowing the Arduino to turn the TV on or off. (Note that Sony codes must be sent 3 times according to the protocol.)"

Yours once?

I got the following:

Value: 1766718754

...
irsend.sendSony(0x384BA081, 32);

Why?

1766718754 in hex is: 0x694DFD22

The Sony IR Protocol isn't usually 32 bits long. The ones I have seen can be 8, 12, 15, 20 or 24 bits long.

...and your original post didn't indicate that it was decoded as Sony. It actually looks like it wasn't decoded(identified as Sony) by IRremote at all, based on what you posted.

My Suggestion: Use the RAW mode and try again. (sendRAW for tx ).

Just because the device is Sony, doesn't mean the IR protocol has to be Sony, although 90% of the time you would expect to to be. Sometimes they just re-badge products designed/manufactured by third parties. (not only Sony)

If you still have problems after trying sendRAW, post the raw output from IRremote & I will have a look at it for you.
(looks like RAW (68): nnn,nnn etc)