Cash Bounty for IRRemote IRrecv Port! :) [SOLVED]


#46

Thank you ScruffR.
I am using Safari and OS X Yosemite.

Eventually I got it to work.
Honestly, I think it was the warning that knocked me off track each time

Telling me I wasn’t including the file so I would include it again. This time I just ignored the warning and it worked. Thanks and if anyone else is having trouble getting it to work I’ll probably be able to help.


#47

@Lindsay, you can just drag and drop or copy-paste images into the post, you don’t need and shouldn’t use dodgy image hosters in this forum, please.


#48

OK thanks, I did not know.
Maybe Particle could put a button on the toolbar for insert image.


#49

There is

It’s an upload button


#50

Fantastic :slight_smile:


#51

@ScruffR Apologies if this is coming in at the wrong point of reply. I am trying to use the IRremote library to implement a simple IR based beacon/virtual tether. The idea being an IR beacon (emitter) is placed on a ceiling/wall in a room and if the tethered devices (receivers) stop detecting the IR beacon signal then they have been removed from the room and will publish an event/alarm message.

I have included the IRremote (0.0.1) library off the web IDE in a simple receiving test code and this works fine when driven by a keyes IR handset.

I have write a very simple sketch using IRremote again to transmit a Sony Power on code

#include <IRremote.h>

/*******************************************************
 * Simple IR LED Beacon demo
 * 9 March 2017
 * Note TX is the output pin hard baked in
 * *****************************************************/

#define LED_PIN D7
//
IRsend irsend;
//
void setup()
{
    Serial.begin(9600);
    pinMode(LED_PIN, OUTPUT);
    digitalWrite(LED_PIN, LOW);
    delay(2000);
    Serial.println("setup in IR Beacon");
}
//
void loop() 
{
    Serial.println("Transmit Data");
    for (int i = 0; i < 50; i++)
    { 
        irsend.sendSony(0xa90, 12); // Sony TV power code
        digitalWrite(LED_PIN, HIGH);
        delay(40);
        digitalWrite(LED_PIN, LOW);
    }
    Serial.println("Wait 5 seconds");
    delay(5000);
}

However, when I build this I get the following error:

/src/irbeacon.cpp:1:22: fatal error: IRremote.h: No such file or directory
 #include <IRremote.h>
                      ^

compilation terminated.
make[1]: *** [../build/target/user/platform-6src/irbeacon.o] Error 1
make: *** [user] Error 2

Clearly I am missing something here :grimacing:


#52

Have you actually imported the library in your project or just added the #include statement?

Your project/code drawer (<>) would need to look like this


#53

I have imported the library and I have tried removing it and adding it back again. I agree it appears as though I have not imported the library.


#54

I have just tried copying the code into a new app and then importing the library and it worked!

I have one other question though - there is no parameter for the pin on the IRsend function - looking at the library which has had many authors is the output pin A5 or TX? I ask this because I am getting no response on my IR receiver. I guess I could put my DSO on each pin and see what is happening.


#55

The output pin should be A5 (in code called TIMER_PWM_PIN)
Since this library is originally meant for a specific IR-Tranceiver board the TX pin wasn’t made selectable.


#56

Thanks. That’s what I had originally thought and then saw TX was used in examples. It may be that the IR LED isn’t working or I have not wired it correctly - I am assuming that the LED is wired to GND via a 150ohm resistor? Another reason it may not work is that the IR code may not being recognised by the receiver side.

I have hooked up the DSO and I am getting a carrier signal - a nice sine wave (40kHz ish?) and spikes up and down which travel along the wave when there is a transmission.

I see that the (much) simpler IRTransmitter library has been used more than the IRremote - given I just want to send a simple and unique signal pulse rather than a TV remote code would it be better if I used that library?

Thanks


#57

You should be able to use a visible light LED to check the output and when you use a web or phone camera they often can record IR signals to check whether your IR transmitter does anything at all.


#58

It might be that the LED isn’t an IR emitter! I have some on order - can retest then.

Any thoughts about the IRTransmitter library - it is a lot simpler.


#59

@AnalysIR I finally got a day off so went back to look at this (and because of recent troubles users were having using the github lib).

I ported the latest (v2.2.1) of the source but someone has published my first version using using the name IRremote (TommyB…are you reading this?). If they can remove it then I can publish this updated version in v2 format.


#60

@mdoan7, can you post the most recent link to your repo?
If @tommy_boy is the member who contributed your library, you may open an issue on his repo, but he won’t be able to remove the lib once it was imported to someone else’s project.
But Particle can transfer ownership once we can establish the facts (ping @jvanier).

Meanwhile, have you migrated your lib to the v2.0 structure?
This also allows to set the secondary dependencies to rid users of the need to import SparkIntervalTimer manually.

Having the lib in a publishable v2.0 format is compulsory now.

The repos I found in your GitHub are not v2.0 compliant (yet)
https://github.com/babean/IRRemote
https://github.com/babean/Arduino-IRremote


#61

@ScruffR,@patyork,@jerware, here’s the git for the updated lib (it’s V2.0 compliant). I renamed the root directory and made a wrapper (empty .h/.cpp) to test compile on webIDE.

@jvanier, here’s the link to the original port of the lib.


#62

I see, thanks for the clarification.

In order to upload it tho’ you may need to notch up the version number higher than the highest already published version.


#63

@ScruffR @mdoan7 I’d really like to get this working. I have tried copying the .h and .cpp files from github into local libraries on Web IDE. I am getting the following build warnings and errors. I am guessing there is a simple explanation for an expert/someone familiar with this code?

lib/IRremote/src/SparkIntervalTimer.cpp: In member function 'void IntervalTimer::interrupt_SIT(action)':
lib/IRremote/src/SparkIntervalTimer.cpp:360:15: warning: variable 'TIMx' set but not used [-Wunused-but-set-variable]
  TIM_TypeDef* TIMx;
               ^
lib/IRremote/src/SparkIntervalTimer.cpp: In member function 'void IntervalTimer::start_SIT(intPeriod, bool)':
lib/IRremote/src/SparkIntervalTimer.cpp:276:23: warning: 'TIMx' may be used uninitialized in this function [-Wmaybe-uninitialized]
  TIM_Cmd(TIMx, ENABLE);
                       ^
lib/IRremote/src/SparkIntervalTimer.cpp: In member function 'void IntervalTimer::stop_SIT()':
lib/IRremote/src/SparkIntervalTimer.cpp:346:18: warning: 'TIMx' may be used uninitialized in this function [-Wmaybe-uninitialized]
  TIM_DeInit(TIMx);
                  ^
lib/IRremote/src/SparkIntervalTimer.cpp: In member function 'void IntervalTimer::resetPeriod_SIT(intPeriod, bool)':
lib/IRremote/src/SparkIntervalTimer.cpp:476:23: warning: 'TIMx' may be used uninitialized in this function [-Wmaybe-uninitialized]
  TIMx->PSC = prescaler;
                       ^
../../../build/target/user/platform-6/libuser.a(IRremote.o): In function `MATCH':
lib/IRremote/src/SparkIntervalTimer.h:126: multiple definition of `timer_isr()'
../../../build/target/user/platform-6/libuser.a(IRremote.o):/src/IRremote.cpp:133: first defined here
../../../build/target/user/platform-6/libuser.a(IRremote.o): In function `MATCH(int, int)':
lib/IRremote/src/IRremoteInt.h:186: multiple definition of `MATCH(int, int)'
../../../build/target/user/platform-6/libuser.a(IRremote.o):/src/IRremote.cpp:51: first defined here
../../../build/target/user/platform-6/libuser.a(IRremote.o): In function `MATCH_MARK(int, int)':
lib/IRremote/src/IRremoteInt.h:187: multiple definition of `MATCH_MARK(int, int)'
../../../build/target/user/platform-6/libuser.a(IRremote.o):/src/IRremote.cpp:71: first defined here
../../../build/target/user/platform-6/libuser.a(IRremote.o): In function `MATCH_SPACE(int, int)':
lib/IRremote/src/IRremoteInt.h:188: multiple definition of `MATCH_SPACE(int, int)'
../../../build/target/user/platform-6/libuser.a(IRremote.o):/src/IRremote.cpp:97: first defined here
../../../build/target/user/platform-6/libuser.a(IRremote.o): In function `MATCH_SPACE(int, int)':
lib/IRremote/src/SparkIntervalTimer.h:106: multiple definition of `timer'
../../../build/target/user/platform-6/libuser.a(IRremote.o):/usr/local/gcc-arm-embedded-gcc-arm-none-eabi-4_8-2014q2-20140609-linux-tar-bz2/arm-none-eabi/include/c++/4.8.4/functional:2069: first defined here
../../../build/target/user/platform-6/libuser.a(IRremote.o): In function `MATCH_SPACE(int, int)':
lib/IRremote/src/SparkIntervalTimer.h:106: multiple definition of `irparams'
../../../build/target/user/platform-6/libuser.a(IRremote.o):/usr/local/gcc-arm-embedded-gcc-arm-none-eabi-4_8-2014q2-20140609-linux-tar-bz2/arm-none-eabi/include/c++/4.8.4/functional:2069: first defined here
/usr/local/gcc-arm-embedded-gcc-arm-none-eabi-4_8-2014q2-20140609-linux-tar-bz2/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/bin/ld: Warning: size of symbol `irparams' changed from 420 in ../../../build/target/user/platform-6/libuser.a(IRremote.o) to 412 in ../../../build/target/user/platform-6/libuser.a(IRremote.o)
../../../build/target/user/platform-6/libuser.a(IRremote.o): In function `MATCH_SPACE(int, int)':
lib/IRremote/src/SparkIntervalTimer.h:106: multiple definition of `irout_khz'
../../../build/target/user/platform-6/libuser.a(IRremote.o):/usr/local/gcc-arm-embedded-gcc-arm-none-eabi-4_8-2014q2-20140609-linux-tar-bz2/arm-none-eabi/include/c++/4.8.4/functional:2069: first defined here
collect2: error: ld returned 1 exit status
make: *** [842428a73c4493282cc99192e0fe7007669daefa63f8b4c7163e739469c3.elf] Error 1

#64

It seems you got the library (or parts of it) imported twice.


#65

@scruffR Thanks - good steer. Problem was in SparkIntervalTimer.cpp - something odd with the IDE. However, I still have one error. Looks like the copy from github of IRremote.cpp was incomplete.