barakwei / IRelectra

Electra A/C IR Encoder for IRremote
GNU General Public License v2.0
32 stars 10 forks source link

Demo code fails because of IRsend expecting a variable #1

Closed guysoft closed 9 years ago

guysoft commented 10 years ago

When using IRremote.h from here: https://github.com/shirriff/Arduino-IRremote

It seems like the decleration of IRSend takes not variables:

class IRsend
{
public:
  IRsend() {}
...

If I run it I get:

irtest.ino: In function ‘void loop()’:
irtest.ino:28:26: error: no matching function for call to ‘IRsend::IRsend(int)’
irtest.ino:28:26: note: candidates are:
In file included from IRelectra.h:14:0,
                from irtest.ino:6:
IRremote.h:97:3: note: IRsend::IRsend()
IRsend() {}
^
IRremote.h:97:3: note:   candidate expects 0 arguments, 1 provided
IRremote.h:94:7: note: IRsend::IRsend(const IRsend&)
class IRsend
    ^
IRremote.h:94:7: note:   no known conversion for argument 1 from ‘int’ to ‘const IRsend&’
barakwei commented 10 years ago

Use the constructor suitable for your IRremote implementation. The demo code uses spark core implementation from here: https://github.com/qwertzguy/Spark-Core-IRremote/

narkisr commented 9 years ago

Hey Barak, can you specify which hardware you used exactly?

I did find this intro http://www.blackcj.com/blog/2014/08/10/control-an-ir-device-with-a-spark-core/

barakwei commented 9 years ago

The circuit you provided is not great, at the power to the led is coming from the GPIO pin, but generally it should work. A good circuit is here - https://www.sparkfun.com/products/10732 You can get it here - https://www.4project.co.il/product/1063 It's designed for 5v, and it will work with the spark core which is 3.3v and the led will get ~20ma instead of 50ma which should give you lower range.

The schematic for this circuit is here - http://cdn.sparkfun.com/datasheets/Kits/PowerIR-v11.pdf if you want the led to get 50ma, you'll need to replace the 56ohm resistor with ~22ohm resistor.

Personally I didn't use the board, but my circuit is the same as the one in the schematic with corrected resistor.