Hello everybody
I'm a beginner in programming with arduino but I'm trying to run a rfid reader with adruino. The RFID Reader is from seeedstudio (125KHz). I have connected the Reader mit 5V/Ground and also to the pins 13(RX) and 14(TX) (Serial1). Now I have the problem that when I upload my code nothing happens. I imagine that after compiling and running the code by placing a rfid-tag near the reader coil the ID of the rfid tag should appear in the serial monitor. Below you can see my code.
I would appreciate any kind of help, since in the web I really cannot find anything what helps my further.
Thank you.
unsigned char buffer[64]; // buffer array for data receive over serial port
int count = 0; // counter for buffer array
void setup()
{
Serial1.begin(9600); // the SoftSerial baud rate
Serial.begin(9600); // the Serial port of Arduino baud rate.
}
void loop()
{
// if date is coming from software serial port ==> data is coming from SoftSerial shield
if (Serial1.available())
{
while(Serial1.available()) // reading data into char array
{
buffer[count++] = Serial1.read(); // writing data into array
if(count == 64)break;
}
Serial.write(buffer, count); // if no data transmission ends, write buffer to hardware serial port
clearBufferArray(); // call clearBufferArray function to clear the stored data from the array
count = 0; // set counter of while loop to zero
}
if (Serial.available()) // if data is available on hardware serial port ==> data is coming from PC or notebook
{
Serial1.write(Serial.read()); // write it to the SoftSerial shield
}
}
void clearBufferArray() // function to clear buffer array
{
// clear all index of array with 0
for (int i=0; i<count; i++)
{
buffer*=0;*
- } *
}