I am trying read data at 57600 baud, I want to read serial data until read a null character.. and separate it
my tag is (HEX): 9062FD59, At the moment just I can read on serial monitor:
FFFFFF90
0
0
0
FFFFFF90
62
0
0
FFFFFF90
62
FFFFFFFD
0
FFFFFF90
62
FFFFFFFD
59
char code[20];
int val = 0;
int bytesread = 0;
int i = 0;
void setup(){
Serial.begin(57600);
}
void loop()
{
if (Serial.available() > 0 )
bytesread = 0;
while(bytesread < 6)
{
if (Serial.available() > 0)
{
val = Serial.read();
code[i] = val;
i++;
if (code[i]= '\0');
{
break;
}
}
//dont use here
}
Serial.println(code[0], HEX);
Serial.println(code[1], HEX);
Serial.println(code[2], HEX);
Serial.println(code[3], HEX);
}
my reader is connected to Max232 and from it to Rx ArduinoUno, and I have ground commun
the reader r10 works fine connect to max323 and direct to PC using converser serial-usb
reader Iclass https://www.hidglobal.com/products/readers/iclass/r10