Hello Guys!
We are four guys working on a projekt with the RFID Reader ( Blue ) and Arduino ( Leonardo ) . But our problem is when the Reader is connected to the Arduino and the RFID reader shows the RED light( ready ) we get absolutly nothing on our Arduino monitor. There are also a little light on the Arduino ( RX ) who should, but not doing it, light up when signal is received.
our code it :
const int startByte = 10;
const int endByte = 13;
const int tagLength = 10;
const int totalLength = tagLength + 2;
char tag[tagLength + 1];
long lastTagValue = 0;
int bytesread = 0;
void setup()
{
Serial.begin(2400);
pinMode(2, OUTPUT);
digitalWrite(2, LOW);
}
void loop()
{
if(Serial.available() >= totalLength)
{
if(Serial.read() == startByte)
{
bytesread = 0;
while(bytesread < tagLength)
{
int val = Serial.read();
if((val == startByte)||(val == endByte))
break;
tag[bytesread] = val;
bytesread = bytesread + 1;
}
}
if( Serial.read() == endByte)
{
tag[bytesread] = 0;
long tagValue = atol(tag);
Serial.print("RFID tag is: ");
Serial.println(tag);
lastTagValue = tagValue;
}
}
}
We hope someone can help see the problem
// Simon