1

I am attempting to send a RAW IR code using the IRremote.h library. The process for capturing IR pulses is easy to find on the web, but the process for sending them again is not. After a few days, i pieced the following code together:

#include <IRremote.h>
 IRsend irsend;

void setup() {

}

void loop() {

  int IRsignal[] = {

// ON, OFF (in 10's of microseconds)

    90, 86,

    174, 88,

    86, 88,

    86, 88,

    86, 88,

    86, 88,

    86, 88,

    86, 88,

    86, 174,

    88, 86,

    174, 88,

    86, 2340,

    88, 86,

    174, 88,

    86, 88,

    86, 88,

    86, 88,

    86, 88,

    86, 88,

    86, 88,

    86, 174,

    88, 86,

    174, 88,

    86, 0};


      irsend.sendRaw(IRsignal, 10, 38);

      delay(1000);

}

When I run it, i get the following error:

ir_test.ino: In function 'void loop()': ir_test.ino:65:38: error: invalid conversion from 'int*' to 'unsigned int*' [-fpermissive] In file included from ir_test.ino:3:0: /Applications/Arduino.app/Contents/Resources/Java/libraries/RobotIRremote/src/IRremote.h:143:8: error: initializing argument 1 of 'void IRsend::sendRaw(unsigned int*, int, int)' [-fpermissive] void sendRaw(unsigned int buf[], int len, int hz); ^ Error compiling.

I am not sure what I did wrong, or how to convert the data types. Any tips or ideas?

  • Most IR protocols start with a long signal at the beginning. Yours has a 2340 right in the middle. – Gerben Apr 4 '15 at 12:35
2

Use unsigned int IRsignal[] instead.

Also, your array is 48 items long, not 10. So irsend.sendRaw(IRsignal, 48, 38);

  • Now the code compiles and appears to work... no response from the remote device though.... guess the number are a little off – Hoytman Apr 3 '15 at 21:20
  • 1
    If you have a second arduino, you could try to capture the signal being send by the first arduino. – Gerben Apr 4 '15 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.