monkeyboard / Wiegand-Protocol-Library-for-Arduino

Wiegand 26 and Wiegand 34 Protocol Library for Arduino
323 stars 131 forks source link

Arduino Leonardo - no output but on ESP works #29

Closed Netoperz closed 6 years ago

Netoperz commented 6 years ago

Have anyone tested this lib on Leonardo ?

When I use the WiegandTest.ino, I have no output on terminal. Clean lib. and keypad connected to pin 2 and 3 (tested both D1-pin2 and oposite) Tested on two keypads, with Wiegand 26 8bit and Wiegand34 8bit.

But I have output on esp32 with the same code, just changed board and comport.

Wiegand HEX = 4, DECIMAL = 4, Type W8 Wiegand HEX = 5, DECIMAL = 5, Type W8 Wiegand HEX = 6, DECIMAL = 6, Type W8 Wiegand HEX = 7, DECIMAL = 7, Type W8 Wiegand HEX = 8, DECIMAL = 8, Type W8 Wiegand HEX = 9, DECIMAL = 9, Type W8 Wiegand HEX = 0, DECIMAL = 0, Type W8

Any ideas what's wrong ?

Win 10 , IDE 1.8.5

jpliew commented 6 years ago

I think there is a compatibility issue during the transition of Arduino versions.

use

wg.begin(2,digitalPinToInterrupt(2),3,digitalPinToInterrupt(3));

change the pin number required

jpliew commented 6 years ago

Why is it not working? Decimal 0-9 is also the same as 0-9 in HEX

Netoperz commented 6 years ago

Work fine, sorry, hex was my bad, and I've updated the example and created pull request, tested works fine on Leonardo now on both keypads. I'm testing this on Leonardo to Check if the problems with extra bits are relevant to the library or not, and are they platform specific, because they occur mostly on esp32, and may be relevant to the calculation methods used int. or not etc... had those issues on other projects and they were eliminated by changing the calculation methods.

For now no problems on Leonardo

Netoperz commented 6 years ago

@jpliew I have same results with this lib as with NG on ESP32, on Leonardo both works rock solid, On ESP32 extra bits on NG, and sometimes no output here (the extra bits do explain lack of the output since this lib is checking data integrity) In a free time we should look in that problem because it is specific only for ESP, so the problem may be caused by mathematics/proc. architecture, not noise, because there is no noise and extra bits still pops out from time to time. But this lib is now well tested on leonardo on 6 readers in different modes. thanks for good work.

jpliew commented 6 years ago

I can assure you that the extra bits were caused by noise. The reason why the noise is not showing on Leonardo is the noise might not be large enough for 5V Leonardo, but sufficient for a 3.3V ESP32.

Only scope can see the noise. Logic Analyzer cannot see it.

We already proofed that changing to different ESP32 gives different results, some worst. If it is software the result will be the same.

I leave this to you.