Hey, I'm writing a program for reading and checking RFID cards. However I have encountered a problem with flooding. If I hold a card on the read for too long(more than half a second) it will print twice. It will go through the check once and after a delay for 7 seconds it will go trough again.
I am using the Arduino Uno and RDM630.
#include <SoftwareSerial.h>
#define rxPin 6
#define txPin 7
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);
String tegn="";
String kode1="5000893AF310";
String kode2="5100FEA91F19";
byte teller=0;
void setup()
{
Serial.begin(9600);
mySerial.begin(9600);
pinMode(9,OUTPUT);
}
void loop()
{
if (mySerial.available() > 0)
{
teller++;
tegn = tegn+(char)mySerial.read();
if(teller==14)
{
tegn=tegn.substring(1,13);
if(kode1==tegn)
{
Serial.print("Gregor");
Serial.print(";");
Serial.print("Kontorpersonell");
Serial.print(";");
Serial.println(tegn);
digitalWrite(9,HIGH);
delay(4000);
digitalWrite(9,LOW);
}
if(kode2==tegn)
{
Serial.print("Joshua");
Serial.print(";");
Serial.print("Administrasjon");
Serial.print(";");
Serial.println(tegn);
digitalWrite(9,HIGH);
delay(4000);
digitalWrite(9,LOW);¨
}
tegn="";
teller=0;
delay(3000);
}
}
}