so i have a HID r10 reader and i have it working as it should but it reads verry inconsistent not reallyable does anybody maybe know hy it does that ?
black and red are data 0 and data 1
wich i conected to the ardiuno
#include <Wiegand.h>
WIEGAND wg;
#define relaisPin 4
#define schakelaar 5
// registered codes
long long int code = {card ID, card ID};
void setup() {
Serial.begin(9600);
pinMode(relaisPin, OUTPUT);
pinMode(schakelaar, INPUT);
// default Wiegand Pin 2 and Pin 3 see image on README.md
// for non UNO board, use wg.begin(pinD0, pinD1) where pinD0 and pinD1
// are the pins connected to D0 and D1 of wiegand reader respectively.
wg.begin();
}
void loop() {
if(wg.available())
{
Serial.print(“Wiegand HEX = “);
Serial.print(wg.getCode(),HEX);
Serial.print(”, DECIMAL = “);
Serial.print(wg.getCode());
Serial.print(”, Type W”);
Serial.println(wg.getWiegandType());
// for all registered codes
for(int i = 0; i < (sizeof(code) / sizeof(code[0])); i++){
// if code is registered
if(wg.getCode() == code[i]){
// do the thing
Serial.println("if statement ran"); //debug
digitalWrite(relaisPin, HIGH);
delay(10000);
digitalWrite(relaisPin, LOW);
delay(500);
}
}
}
if(digitalRead(schakelaar) == HIGH){
digitalWrite(relaisPin, HIGH);
delay(10000);
digitalWrite(relaisPin, LOW);
delay(500);
}
}
Wiegand HEX = mycard, DECIMAL = my card, Type W34
inf statement ran
Wiegand HEX = 5, DECIMAL = 5, Type W4
Wiegand HEX = 5, DECIMAL = 5, Type W4
Wiegand HEX = 82AA8154, DECIMAL = 2192212308, Type W34
Wiegand HEX = D6AAD2B5, DECIMAL = 3601519285, Type W34
Wiegand HEX = 5, DECIMAL = 5, Type W4
Wiegand HEX = 5, DECIMAL = 5, Type W4
Wiegand HEX = 5, DECIMAL = 5, Type W4
Wiegand HEX = 5, DECIMAL = 5, Type W4
Wiegand HEX = 5, DECIMAL = 5, Type W4
Wiegand HEX = D, DECIMAL = 13, Type W4
Wiegand HEX = 7223CC46, DECIMAL = 1914948678, Type W34
Wiegand HEX = mycard, DECIMAL = mycard, Type W34
if statement ran
in between the my cards and inf statemt is random stuf the reader spits out every once in a while
with kind regards simon