-
Notifications
You must be signed in to change notification settings - Fork 132
Open
Description
Was just wondering whether it would be possible to monitor two readers with the same controller. I tried the following code but it only logs reads from Wiegand1.
#include <Wiegand.h>
WIEGAND wg1;
WIEGAND wg2;
const int pinD01 = 2;
const int pinD11 = 3;
const int pinD02 = 18;
const int pinD12 = 19;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
wg1.begin(pinD01, pinD11);
wg2.begin(pinD02, pinD12);
}
void loop() {
// put your main code here, to run repeatedly:
if(wg1.available()) {
Serial.print("Wiegand1 HEX = ");
Serial.print(wg1.getCode(),HEX);
Serial.print(", DECIMAL = ");
Serial.print(wg1.getCode());
Serial.print(", Type W");
Serial.println(wg1.getWiegandType());
}
if(wg2.available()) {
Serial.print("Wiegand2 HEX = ");
Serial.print(wg2.getCode(),HEX);
Serial.print(", DECIMAL = ");
Serial.print(wg2.getCode());
Serial.print(", Type W");
Serial.println(wg2.getWiegandType());
}
}