Skip to content

Support for multiple instances of WiegandNG? #8

@NamoDev

Description

@NamoDev

Hello,

I recently tried this library out and would say it's perhaps one of the nicest I've seen. Works perfectly with most types of readers, including HID iCLASS SE readers :)

Right now I could handle one Wiegand device on a single Arduino just fine. However, I would like to be able to handle two independent readers on the same Arduino (in this case, an Arduino Nano Every with interrupt support on all pins) and it seems that I have ran into a little snag.

If I modify the example code to be:

WiegandNG wg;
WiegandNG wg2;

// PrintBinary() function removed from this snippet to simplify things (no changes have been made to it)

void setup() {
    Serial.begin(115200);

    unsigned int wiegandbits = 48;
    unsigned int packetGap = 15; // 25 ms between packet

    if (!wg.begin(14, 15, wiegandbits, packetGap)) {
        Serial.println("WG Out of memory!");
    }

    if (!wg2.begin(17, 18, wiegandbits, packetGap)) {
        Serial.println("WG2 Out of memory!");
    }

    Serial.println("Ready...");
}

void loop() {
    if (wg.available()) {
        wg.pause();
        Serial.print("WG Bits=");
        Serial.println(wg.getBitCounted());
        Serial.print("RAW Binary=");
        PrintBinary(wg);
        wg.clear();
    }

    if (wg2.available()) {
        wg2.pause();
        Serial.print("WG2 Bits=");
        Serial.println(wg2.getBitCounted());
        Serial.print("RAW Binary=");
        PrintBinary(wg2);
        wg2.clear();
    }
}

It seems that the Arduino would not be able to correctly indicate from which instance a read has occured (with a read from the same keypad, sometimes it'd say it's from wg, sometimes it'd say it's from wg2). Is this a problem with the library, or am I instantiating it incorrectly in this case?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions