LuisMiCa / IRsmallDecoder

A small, fast and reliable infrared signals decoder to control Arduino projects with remotes.
MIT License
15 stars 5 forks source link

Error compiling for Digispark #1

Closed corvin78 closed 4 years ago

corvin78 commented 4 years ago

Hi, I can see that Digispark is not within supported boards, but it should work, as for example this one: https://www.instructables.com/id/DIY-USB-IR-receiver/ uses the same idea of interrupt.

The error it gives:

In file included from C:\Users***\Documents\Arduino\IRremote\IRremote.ino:2:0:

C:\Users***\Documents\Arduino\libraries\IRsmallDecoder\src/IRsmallDecoder.h: In constructor 'IRsmallDecoder::IRsmallDecoder(uint8_t)':

C:\Users***\Documents\Arduino\libraries\IRsmallDecoder\src/IRsmallDecoder.h:76:53: error: 'digitalPinToInterrupt' was not declared in this scope

attachInterrupt(digitalPinToInterrupt(interruptPin), irISR, IR_ISR_MODE);

                                                 ^

exit status 1

Tried to compile just the example from github webpage (copy/paste) with Arduino IDE 1.8.5.

Regards,

PS. Just searching for the issue found this: https://forum.arduino.cc/index.php?topic=557534.msg3802846#msg3802846 - maybe it will be helpful?

LuisMiCa commented 4 years ago

The digitalPinToInterrupt() is an Arduino function that is not supported on ATtiny microcontrollers. I don't have any of those, so it won't be easy for me to test any solutions that I might find. But, when I'll get some free time, I'll look into it.

For now you can try to change the line attachInterrupt(digitalPinToInterrupt(interruptPin), irISR, IR_ISR_MODE); in the IRsmallDecoder.h file to attachInterrupt(0, irISR, IR_ISR_MODE); and see if it works...

In the ATtiny85, the interrupt 0 is the external interrupt that this library might work with and it corresponds to Pin2 of PORTB (the physical pin number 7 of the IC).

If this works, please let me know. It will be very helpful. Thanks.

corvin78 commented 4 years ago

Hello,

I can confirm that it works with the modification you provided in previous post. When I copy/paste the code and set LED_BUILTIN = 1; it turns on and off green LED on every keypress on my remote (NEC)!

I will do some more tests in near future.

Cheers!

LuisMiCa commented 4 years ago

That's good to hear. Thank you for testing it. After I'm done with the Samsung protocol, I will add support for some of the ATtiny microcontrollers.

Thanks

corvin78 commented 4 years ago

Hi,

I made some further tests getting the codes from remote and later operating a PC with this remote (TrinkedHIDCombo library) and it works well together. It handles key repetitioins very nicely. The only issue I had is it sometimes miss a keypress on my remote, but it is most probably the issue with my crappy remote. If you would like we can close this "issue".

Regards,

LuisMiCa commented 4 years ago

OK. BTW, a new version of this library is almost ready and should support several ATtiny microcontrollers. If you update to the new library, you won't have to change the IRsmallDecoder.h file again but don't forget to use the correct digital pin (2 in you case) when creating the decoder object (if you use some other pin there, it might work anyway but with some possible issues).

Regards,