rwblinn Well-Known Member Licensed User Longtime User Apr 25, 2016 #1 Hi, in the process of attempting to wrap attached IRRemote Library - see rIRRemote.h and cpp. Started with class IRrecv first but got stuck In IRremote.h the IRrecv class hass following definition, which is not clear how to wrap. Code: public: IRrecv (int recvpin) ; IRrecv (int recvpin, int blinkpin); ... defined in IRremote.cpp as Code: IRrecv::IRrecv (int recvpin) { irparams.recvpin = recvpin; irparams.blinkflag = 0; } ... Any help / hints appreciated. Attachments rIRRemote.zip rIRRemote.zip 35.9 KB · Views: 832
Hi, in the process of attempting to wrap attached IRRemote Library - see rIRRemote.h and cpp. Started with class IRrecv first but got stuck In IRremote.h the IRrecv class hass following definition, which is not clear how to wrap. Code: public: IRrecv (int recvpin) ; IRrecv (int recvpin, int blinkpin); ... defined in IRremote.cpp as Code: IRrecv::IRrecv (int recvpin) { irparams.recvpin = recvpin; irparams.blinkflag = 0; } ... Any help / hints appreciated.
Erel B4X founder Staff member Licensed User Longtime User Apr 26, 2016 #2 These are constructors. It is indeed a bit more difficult. You can see several examples: 1. rLiquidCrystal 2. rSoftwareSerial
These are constructors. It is indeed a bit more difficult. You can see several examples: 1. rLiquidCrystal 2. rSoftwareSerial
rwblinn Well-Known Member Licensed User Longtime User Apr 26, 2016 #3 That helped a lot = got the constructors wrapped and compiled without error - using rSoftwareSerial example. Next which I have not found a solution, is how to wrap: Code: int decode (decode_results *results) ; where decode_results is a class. Any hints here?
That helped a lot = got the constructors wrapped and compiled without error - using rSoftwareSerial example. Next which I have not found a solution, is how to wrap: Code: int decode (decode_results *results) ; where decode_results is a class. Any hints here?
Erel B4X founder Staff member Licensed User Longtime User Apr 26, 2016 #4 Something like: Code: ULong Decode() { decode_results dr; decode(&dr); return dr.value; } If you want to return more than a single value then you can create your own class and return it instead of returning ULong.
Something like: Code: ULong Decode() { decode_results dr; decode(&dr); return dr.value; } If you want to return more than a single value then you can create your own class and return it instead of returning ULong.
rwblinn Well-Known Member Licensed User Longtime User Apr 26, 2016 #5 Thanks again for help. Made progress and able to receive data when pressing the remote control - BUT only the first 2 times after pressing on the Remote Control to Turn Pin 13 On / Off. Code: 1-IRReceive: 16724175 2-IRReceive: 16718055 In the B4R Code added a Looper to listen to IR data coming in via sub IRReceive. When data comes in, the value is checked to turn pin 13 on or off. when done IRRecv.Resume is called. BUT after two times nothing happens anymore? Could there be a clash between the Looper and the IRRecv.Resume call? or is the logic of handling decode value wrong. Attached: Wrapped Library (receive part) and B4R test code. Attachments B4RHowToIRRecv.zip B4RHowToIRRecv.zip 37.6 KB · Views: 905
Thanks again for help. Made progress and able to receive data when pressing the remote control - BUT only the first 2 times after pressing on the Remote Control to Turn Pin 13 On / Off. Code: 1-IRReceive: 16724175 2-IRReceive: 16718055 In the B4R Code added a Looper to listen to IR data coming in via sub IRReceive. When data comes in, the value is checked to turn pin 13 on or off. when done IRRecv.Resume is called. BUT after two times nothing happens anymore? Could there be a clash between the Looper and the IRRecv.Resume call? or is the logic of handling decode value wrong. Attached: Wrapped Library (receive part) and B4R test code.
Erel B4X founder Staff member Licensed User Longtime User Apr 27, 2016 #6 I don't see any obvious mistake in the code. You can add log messages to the library with: Code: ::Serial.println("aaa"); Might help you find out what happens.
I don't see any obvious mistake in the code. You can add log messages to the library with: Code: ::Serial.println("aaa"); Might help you find out what happens.
rwblinn Well-Known Member Licensed User Longtime User Apr 28, 2016 #7 Some progress made. B4R Code: Added a Delay(150) in the Looper, working (almost = sometimes need to press twice to see a reaction on the LED) OK. Using ::Serial is a good helper. In addition found a new IRRemote Lib based on the IRRemote Lib I have been using. This new lib is able to handle interrupts better - which might solve the problem facing as mentioned earlier. Will explore further - means wrap IRLib. Last edited: Apr 28, 2016
Some progress made. B4R Code: Added a Delay(150) in the Looper, working (almost = sometimes need to press twice to see a reaction on the LED) OK. Using ::Serial is a good helper. In addition found a new IRRemote Lib based on the IRRemote Lib I have been using. This new lib is able to handle interrupts better - which might solve the problem facing as mentioned earlier. Will explore further - means wrap IRLib.
Erel B4X founder Staff member Licensed User Longtime User May 1, 2016 #8 rwblinn said: Added a Delay(150) in the Looper Click to expand... This means that you need to use a timer instead. Timers, Loopers and CallSubPlus
rwblinn said: Added a Delay(150) in the Looper Click to expand... This means that you need to use a timer instead. Timers, Loopers and CallSubPlus
A atiaust Active Member Licensed User Longtime User May 17, 2016 #9 Hi, When I try to use java -jar B4Rh2xml <path to h file> <output file> to wrap a library I get the following error message Error: unable to access jarfile B4Rh2xml Click to expand... I have tried putting B4Rh2xml.jar in multiple locations. No Luck. Any ideas as to what I am doing wrong. Thanks
Hi, When I try to use java -jar B4Rh2xml <path to h file> <output file> to wrap a library I get the following error message Error: unable to access jarfile B4Rh2xml Click to expand... I have tried putting B4Rh2xml.jar in multiple locations. No Luck. Any ideas as to what I am doing wrong. Thanks
Erel B4X founder Staff member Licensed User Longtime User May 17, 2016 #10 You should have started a new thread for this question. You should use: Code: java -jar B4RH2xml.jar <path to h file> <output file>
You should have started a new thread for this question. You should use: Code: java -jar B4RH2xml.jar <path to h file> <output file>
A atiaust Active Member Licensed User Longtime User May 17, 2016 #11 Erel said: You should have started a new thread for this question. You should use: Code: java -jar B4RH2xml.jar <path to h file> <output file> Click to expand... Sorry. Realised should have created new thread after I had posted. Will try as suggested.
Erel said: You should have started a new thread for this question. You should use: Code: java -jar B4RH2xml.jar <path to h file> <output file> Click to expand... Sorry. Realised should have created new thread after I had posted. Will try as suggested.