Multi-Reader-Wiegand-Protocol-Library-for-Arduino
Multi-Reader-Wiegand-Protocol-Library-for-Arduino copied to clipboard
Support for esp boards
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?
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.
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, if you change
attachPinChangeInterrupttoattachInterruptin 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
I fixed it by changing it to "digitalPinToInterrupt"
I fixed it by changing it to "digitalPinToInterrupt"
Hi, Which lines do you alter ?
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.