akshaykirti:
I got this rfid reader today and it dosnt seem to work… as i understand, if i connect it’s tx to arduinos rx, it should give me an STX value of 02h. Or something like that…
So… How is this supposed to work exactly…
My code is:
int incomingByte = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
incomingByte = Serial.read();
Serial.println(incomingByte,BYTE);
}
As i understand.. i should get a value.
The rx light is also not blinking..
Help!
Have connected everything besides the pin 2 and pin 3..
As required in the datasheet.. have connected an led which is glowing very slightly. And an Antenna.. I do have RFID tags which are supposedly 125 khz but cnt confirm. BUT, It is supposed to return an value to the rx?
Right?
I get an output of ÿÿÿÿÿÿ
Data sheet :[http://www.chinareader.cn/images/_20089 ... 722949.pdf](http://www.chinareader.cn/images/_200892414581722949.pdf)
I’m by FAR not an expert in this stuff, beginning myself, but I have a similar function to read data coming off TX/RX pins to display text on a LED matrix.
Data is received in 1 byte at a time on the RX pin, so you need to have something like:
void loop()
{
char inByte;
if (Serial.available())
{
inByte = Serial.read();
//if (inByte == '\n')
if (inByte == 13) //Carriage Return (Enter Key)
{
// 'newline' character
inputBuffer[bufferPointer++] = '\0';
scrolltextsizexcolor(0,inputBuffer,1,GREEN, 0,my2font,8,8,'G',40);
//scrolltextsizey(1,inputBuffer,1,GREEN, 0,my2font,8,8,'G',40);
loopstate = digitalRead(LoopSwitch);
while (loopstate != false) { //if loop switch is enabled, loop text until it is turned off
loopstate = digitalRead(LoopSwitch); //check loop value to see if it has changed (gone from high to low, or vice versa.
scrolltextsizexcolor(0,inputBuffer,1,GREEN, 0,my2font,8,8,'G',40);
}
bufferPointer = 0;
}
else
if (inByte == 8) //'backspace' character
{
inputBuffer[bufferPointer--];
}
else
{
// not a 'newline' character
if (bufferPointer < bufferSize - 1) // Leave room for a null terminator
inputBuffer[bufferPointer++] = inByte;
}
}
}
you can ignore the loopswitch and such, i have the option to make my display repeat. You have to increment each byte from RX, as it comes in 1 byte at a time. When it detects no serial data, then output the results.
Again, I’m no expert so maybe I’m wrong, but I’m receving in serial data just like you and my code works, so it might help you.