Multi-Reader-Wiegand-Protocol-Library-for-Arduino icon indicating copy to clipboard operation
Multi-Reader-Wiegand-Protocol-Library-for-Arduino copied to clipboard

Support for esp boards

Open ZeffeCode opened this issue 3 years ago • 8 comments

Hello, Is there any way to make this library work with esp boards? I tried to upload the exemple sketch to a esp8266 and a error appeard: "avr/io.h: No such file or directory" I searched through the web to try and find a solution, but got nothing. Is there something I'm doing wrong?

ZeffeCode avatar Jul 27 '22 15:07 ZeffeCode

Hi, this library depends on PinChangeInterrupt https://github.com/NicoHood/PinChangeInterrupt that only support certain AVR. I can see that the default Arduino now can support pin change interrupt. I will add this to "enhancement request" and find time to port over the pin change interrupt. In the meantime, if you can, please feel free to change the code to use Arduino default pin change interrupt.

jpliew avatar Jul 27 '22 23:07 jpliew

Hi, if you change attachPinChangeInterrupt to attachInterrupt in lines 51 and 52 of WiegandMulti.cpp, it should work. I have tested the modified code on an Adafruit ItsyBitsy m0 (SAMD21), but I believe it should also work with esp8266.

I could create a pull request if given permission.

TwoPrusTwo avatar Oct 10 '23 20:10 TwoPrusTwo

Hi, if you change attachPinChangeInterrupt to attachInterrupt in lines 51 and 52 of WiegandMulti.cpp, it should work. I have tested the modified code on an Adafruit ItsyBitsy m0 (SAMD21), but I believe it should also work with esp8266.

I could create a pull request if given permission.

Hi @TwoPrusTwo, do i only need to change the two lines? But then i still get an error with my esp: PinChangeInterrupt.h:30:10: fatal error: avr/io.h: No such file or directory

And if i remove the PinChangeInterrupt.h from the cpp, i get this error:

WiegandMulti.cpp:51:18: error: 'digitalPinToPinChangeInterrupt' was not declared in this scope
  attachInterrupt(digitalPinToPinChangeInterrupt(pinD0), ISR_D0, FALLING);  // Hardware interrupt - high to low pulse
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
c:\Users\Felix\OneDrive\Dokumente\Arduino\libraries\WiegandMulti\src\WiegandMulti.cpp:51:18: note: suggested alternative: 'digitalPinToInterrupt'
  attachInterrupt(digitalPinToPinChangeInterrupt(pinD0), ISR_D0, FALLING);  // Hardware interrupt - high to low pulse
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                  digitalPinToInterrupt

Secarius avatar Oct 27 '23 13:10 Secarius

I fixed it by changing it to "digitalPinToInterrupt"

Secarius avatar Oct 27 '23 13:10 Secarius

I fixed it by changing it to "digitalPinToInterrupt"

Hi, Which lines do you alter ?

pedroogh avatar Dec 13 '23 15:12 pedroogh

Hi @pedroogh,

These were the changes I made: Removed line 2: #include "PinChangeInterrupt.h" Changed line 51: attachInterrupt(digitalPinToInterrupt(pinD0), ISR_D0, FALLING); Changed line 52: attachInterrupt(digitalPinToInterrupt(pinD0), ISR_D1, FALLING);

Please note that, as @jpliew mentioned, not all AVR boards are supported. The Arduino attachInterrupt documentation has a table of supported boards and which pins are available.

TwoPrusTwo avatar Dec 13 '23 22:12 TwoPrusTwo