[Error Message] How to use IR-Remote Library for Multiple Pin to Send IRCode

Hi all,

sorry my bad english fisrt :slight_smile:

i need some guidance and advise about library for multiple send IR-Code with Multiple Pin.
i’m very newbie and still learning in arduino and programming,

now i have project to send IR-Code with Multiple pin ( not only pin 9 [Arduino Mega 2560] ),
when i’m googling i’ve found this thread and similar with my project

and then see that the people there with library and code is work, but not for me and i dont know why :confused: .

here is the step that i’ve done :

  • Replace file IRremote.cpp , IRremote.h, IRremoteInt.h in folder IRrmote Library with file in MAUDI LIBRARY folder.
  • open MULTI_CHANNEL_TV_AC_FIX.ino file and Compile.
  • found error when compile program ( error_1 ).
  • change ino code with simple code like this :
    void loop()
    {
    for (int i = 0; i < 3; i++) {
    irtv1.sendRaw(TV_power, 67, 38);
    irtv2.sendRaw(TV_power, 67, 38);
    irac1.sendRaw(AC_on, 60, 38);
    irac2.sendRaw(AC_on, 60, 38);
    delay(40);
    }
    delay(1000); //1 second delay between each signal burst
    }

but still found error. [ error_2 ]

now i’m very confused about how to using this library, maybe someone have a same trouble like me could share about the problem and share tips to solve it.

H/W & S/W Info that i’m using :

  1. Arduino IDE 1.8.0
  2. Arduino Mega 2560
  3. Using library IRremote at version 2.2.1

Big hope to anyone can help me to solve this, especially for error_2.

Thank you very much.

MULTI_CHANNEL_TV_AC_FIX.zip (24.5 KB)

IRremote.zip (74.7 KB)

error_1.txt (16.7 KB)

error_2.txt (18.2 KB)

Anyone ?

I suspect that you use a bad mix of the old library and the update. Where did you extract the files? I guess that the extracted files should replace the files in the original library folder. Please try to contact Ken Shirriff maudialfarish for this issue.

I've already been experimenting with the (old) IRremote library, and I'd like to extend it further. But don't hold your breath...

I just found that the fix is quite old, probably incompatible with the current IRremote version. Can you find an older version of that library?

DrDiettrich:
I suspect that you use a bad mix of the old library and the update. Where did you extract the files? I guess that the extracted files should replace the files in the original library folder. Please try to contact Ken Shirriff maudialfarish for this issue.

I’ve already been experimenting with the (old) IRremote library, and I’d like to extend it further. But don’t hold your breath…

thanks @DrDiettrich for your suggestion, i’m really appreciate it.

for the placing file question, yes i replace the original file in library folder with maudialfarish file as i mention before.

i’ve tried to use old IRremote Libs version 1.0 from here and replace with maudialfarish file (IRremote.cpp , IRremote.h, IRremoteInt.h), then compiling process result is OK, but there found some warning notice like below :

" C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp:533:1: warning: ‘TIMER_INTR_NAME’ appears to be a misspelled signal handler, missing __vector prefix [-Wmisspelled-isr]

ISR(TIMER_INTR_NAME)

^ "

could you tell me what it mean ? and how to fix it ?

i’m attach full log of compiling process with warning notice inside.

Thank you

Warning_Message_With_Timer.txt (9.48 KB)

The interrupt vector names or syntax seem to have changed in the compiler. In boarddefs.h (part of the current IRremote library) I found the vector names with an appended "_vect" suffix, like
#define TIMER_INTR_NAME TIMER1_COMPA_vect
where the old IRremoteint.h contained
#define TIMER_INTR_NAME TIMER1_COMPA

You can edit IRremoteint.h, search for all occurrences of "TIMER_INTR_NAME", and append "_vect" to the name.

DrDiettrich:
The interrupt vector names or syntax seem to have changed in the compiler. In boarddefs.h (part of the current IRremote library) I found the vector names with an appended “_vect” suffix, like
#define TIMER_INTR_NAME TIMER1_COMPA_vect
where the old IRremoteint.h contained
#define TIMER_INTR_NAME TIMER1_COMPA

You can edit IRremoteint.h, search for all occurrences of “TIMER_INTR_NAME”, and append “_vect” to the name.

Thanks for your explanation first,

i already modifying as your suggetion to append "_vect " for all occurrences of “TIMER_INTR_NAME” like below :

//#define TIMER_INTR_NAME TIMER4_OVF_vect
#define TIMER_INTR_NAME_vect TIMER4_OVF_vect

//#define TIMER_INTR_NAME TIMER5_COMPA_vect
#define TIMER_INTR_NAME_vect TIMER5_COMPA_vect

//#define TIMER_INTR_NAME cmt_isr
#define TIMER_INTR_NAME_vect cmt_isr

but still show up the notice :

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:30:0,
from C:\Program Files (x86)\Arduino\libraries\IRremote\IRremoteInt.h:21,
from C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp:21:
C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp: In function ‘void TIMER_INTR_NAME()’:
C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.cpp:533:5: warning: ‘TIMER_INTR_NAME’ appears to be a misspelled signal handler, missing __vector prefix [-Wmisspelled-isr]
ISR(TIMER_INTR_NAME)
^

is there any wrong / missing for what I’ve done ?

The TIMER_INTR_NAME must stay as is.
#define TIMER_INTR_NAME_vect TIMER5_COMPA_vect
should read
#define TIMER_INTR_NAME TIMER5_COMPA_vect

DrDiettrich:
The TIMER_INTR_NAME must stay as is.
#define TIMER_INTR_NAME_vect TIMER5_COMPA_vect
should read
#define TIMER_INTR_NAME TIMER5_COMPA_vect

#define TIMER_INTR_NAME TIMER5_COMPA_vect
It's look like in first condition in old library,
New library is too, did you have to see in my first upload file ?

In old library, there is not complete protocol as the newest version one but not support for multiple pin output .
Then I try to modified the newest with add as maudyalfarish library.
Firsttime there is so many error, but one by can fix, until l'm stuck on this error :
C:\Program Files (x86)\Arduino\libraries\IRremote\irSend.cpp:125:2: error: stray '' in program

TIMER1_CONFIG_KHZ(khz);

^

C:\Program Files (x86)\Arduino\libraries\IRremote\irSend.cpp:125:2: error: stray '' in program

In irSend.cpp i can not found with error stray '' mean Or strange character,
Maybe i miss something in boarddef.h :D.

When i'm googling, I see your name in GitHub,
would you to show up this issue or request to add to support multiple pin output in z3t0 library?

Many thanks

You are right with the #defines, they have been okay already.

IMO you should use the current IRremoteInt.h, not the MULTI_CHANNEL version. Also use the current IRremote.h, and only add the missing class declarations to it.

I doubt that the zt30 library will ever be updated as we would like to see it :frowning:

DrDiettrich:
You are right with the #defines, they have been okay already.

IMO you should use the current IRremoteInt.h, not the MULTI_CHANNEL version. Also use the current IRremote.h, and only add the missing class declarations to it.

I doubt that the zt30 library will ever be updated as we would like to see it :frowning:

Yes exactly, i'm not replace current version with MULTI_CHANNEL file.
I just try to add some modification with following MULTI_CHANNEL structure ( add missing class and enable which timer that i used ) but until now still stuck in error:stray '' and i can't found any strange in irSend.cpp ( still progress to find it and find reference in google :smiley: ).

Basically i'm not have programming experience or background, so i'm not fully understand about error compiling mean hahaha
Hopely, there will be release with this feature soon :smiley:

The '' is the continuation flag in multi-line #defines. Perhaps you pasted not enough lines, or truncated a file so that a '' occurs at the end of a file, or outside a #define? Is there no indication of file, line and column in the error message?

The MULTI_CHANNEL solution #defines different names for each timer, e.g. TIMER2_INTR_NAME for T2, TIMER3_INTR_NAME for T3 etc. This was the real reason for the first error message, because TIMER_INTR_NAME was never defined without a timer number. If you want to follow that pattern, you have to edit all #defines of timer-specific macros in boarddefs.h, and include the timer number in the names. Also remove all the #ifdef IR_USE_TIMERxxx and their #endif from boarddefs.h, so that all numbered macros are always defined. That's much work, and also is the reason why such changes never will find their way into the official library :frowning:

There is also a bug in the MULTI_CHANNEL IRremote.cpp, that prevents the use of multiple receivers. It contains only one ISR for the selected timer (IR_USE_TIMERxxx), but is hard coded for T2 only! A proper solution will require many more tricks :frowning:

But I don't think that multiple receivers make sense at all, because all will receive the same IR transmission at the same time.
The same applies to multiple senders - why can't you use the same sender for transmitting whatever code you like? If you want to send into multiple directions, using multiple IR LED, these can all be controlled by a single output pin. Only a transistor is required to drive each LED, because an output pin can sink only 20mA.

DrDiettrich:
The '' is the continuation flag in multi-line #defines. Perhaps you pasted not enough lines, or truncated a file so that a '' occurs at the end of a file, or outside a #define? Is there no indication of file, line and column in the error message?

The MULTI_CHANNEL solution #defines different names for each timer, e.g. TIMER2_INTR_NAME for T2, TIMER3_INTR_NAME for T3 etc. This was the real reason for the first error message, because TIMER_INTR_NAME was never defined without a timer number. If you want to follow that pattern, you have to edit all #defines of timer-specific macros in boarddefs.h, and include the timer number in the names. Also remove all the #ifdef IR_USE_TIMERxxx and their #endif from boarddefs.h, so that all numbered macros are always defined. That's much work, and also is the reason why such changes never will find their way into the official library :frowning:

There is also a bug in the MULTI_CHANNEL IRremote.cpp, that prevents the use of multiple receivers. It contains only one ISR for the selected timer (IR_USE_TIMERxxx), but is hard coded for T2 only! A proper solution will require many more tricks :frowning:

But I don't think that multiple receivers make sense at all, because all will receive the same IR transmission at the same time.
The same applies to multiple senders - why can't you use the same sender for transmitting whatever code you like? If you want to send into multiple directions, using multiple IR LED, these can all be controlled by a single output pin. Only a transistor is required to drive each LED, because an output pin can sink only 20mA.

DrDiettrich:
The '' is the continuation flag in multi-line #defines. Perhaps you pasted not enough lines, or truncated a file so that a '' occurs at the end of a file, or outside a #define? Is there no indication of file, line and column in the error message?

The MULTI_CHANNEL solution #defines different names for each timer, e.g. TIMER2_INTR_NAME for T2, TIMER3_INTR_NAME for T3 etc. This was the real reason for the first error message, because TIMER_INTR_NAME was never defined without a timer number. If you want to follow that pattern, you have to edit all #defines of timer-specific macros in boarddefs.h, and include the timer number in the names. Also remove all the #ifdef IR_USE_TIMERxxx and their #endif from boarddefs.h, so that all numbered macros are always defined. That's much work, and also is the reason why such changes never will find their way into the official library :frowning:

There is also a bug in the MULTI_CHANNEL IRremote.cpp, that prevents the use of multiple receivers. It contains only one ISR for the selected timer (IR_USE_TIMERxxx), but is hard coded for T2 only! A proper solution will require many more tricks :frowning:

But I don't think that multiple receivers make sense at all, because all will receive the same IR transmission at the same time.
The same applies to multiple senders - why can't you use the same sender for transmitting whatever code you like? If you want to send into multiple directions, using multiple IR LED, these can all be controlled by a single output pin. Only a transistor is required to drive each LED, because an output pin can sink only 20mA.

Actually my application need to other pin for sending IRCode. the code is same, but for time to send is not in the same time sending ( randomly ). My VB program as controller by serial and to control sender pin, which pin will send IRcode (note : device receiver is wait in different time and different place). Sorry if make you confuse about it.

You cannot send two IR codes at the same time, the code returns only after the code has been sent. You'll have to live with that restriction. Multiple transmission at the same time don't make sense, because they interfere with each other.

DrDiettrich:
You cannot send two IR codes at the same time, the code returns only after the code has been sent. You'll have to live with that restriction. Multiple transmission at the same time don't make sense, because they interfere with each other.

sorry for long time in reply,
many thanks for your help and advise for my issue,
i'm add external circuit for solved my project, as long as it's working well for support multiple transmission.
so i'll close this issue in my project :D.
thanks DrDiettrich,

regard
rachman