Problem "emulating" remote control

Hi, Im trying to emulate remote control or replicate it if you want, I managed to get all codes from my remote control, but I cant make Arduino act as an emitter because of a compilation error. Code:

#include <IRremote.h>
IRsend irsend;

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

void loop() {
  if (Serial.read() != -1) {
      irsend.sendNEC(0xE5CFBD7F, 32);
  }
}

Error is in the line with irsend.sendNEC(0xE5CFBD7F, 32); and it says error: expected unqualified-id before ‘(’ token. Dont really know what the problem is.

Thanks in advance.

Hi (ahoj). Remove from the "libraries" all libraries around Robot. Then it will be OK. Library Robot Control rather it contains IR commands.

Or just add

#define DECODE_NEC

before
#include <IRremote.h>

Hi, did exactly what you told me, but nothing helped. Tried to erase all libraries apart from "Arduino-IRremote-master" but didnt help either. Then I tried to replace the library and now I get error: 'class IRsend' has no member named 'sendNEC'. I tried to rename the functions in library before, so maybe I did something wrong and thats why I get that expected unqualified-id before '(' token error.

EDIT: After redownloading the library the compliation error disappeared.

One last question guys, what does this mean - if (Serial.read() != -1){}

One last question guys, what does this mean - if (Serial.read() != -1){}

It means that you didn't bother testing that there was anything available to read. The read() method returns -1 when there is nothing to read, so code in the {} will be executed if there was something to read (though that code will not have access to what was read).