Go Down

Topic: Need Help on RFID Reader (Read 937 times) previous topic - next topic

fendi46

Oct 04, 2012, 09:42 am Last Edit: Oct 05, 2012, 09:42 pm by fendi46 Reason: 1
Hello,

Presently im doing an RFID Project,
I need help on interfacing it to LCD and Serial Monitor.
Coding is below (Updated)...






PaulS

Quote
The problem with this code is :

That the formatting and indenting are terrible. Make the code easy to read by putting each { on a new line, by putting each } on a new line, by putting no more than one statement on a line, and by using Tools + Auto format to fix the horrid indenting.

Quote
- the tag read at rfid shows 1 by 1 at the LCD and Serial Monitor

Because that's how you tell it to appear. How do you want it to appear?

Quote
- serial monitors shows unknown number (the one i mark with yellow color)

They are not unknown. You just don't know what they mean.

You check that there is data to read, before reading it. So, Serial.read() will never return anything in the high byte of the int it returns. The portion that you are interested in is the low byte. So the variable that you store the low byte in should be byte sized, such as uint8_t, byte, or char. Since the data is all character, I'd use char. But, that's just me.

Serial.print()ing an int causes it to be converted to a string. Serial.print() of a char that contains the same value as the int will produce quite different output, and I suspect that is the output you are expecting.

Quote
- currently i connect the buzer with pin 9, are im doing it right? or not...

Unlikely, since you appear to have the LCD connected to pin 9, too.

You have not declared pin 9 to be an output, nor do you have any code that affects pin 9.

fendi46

#2
Oct 04, 2012, 07:24 pm Last Edit: Oct 04, 2012, 07:29 pm by fendi46 Reason: 1
Quote
That the formatting and indenting are terrible. Make the code easy to read by putting each { on a new line, by putting each } on a new line, by putting no more than one statement on a line, and by using Tools + Auto format to fix the horrid indenting.

I just know it now, Thanks, i already use Tools + Auto format and update the code...

Quote
- the tag read at rfid shows 1 by 1 at the LCD and Serial Monitor
Because that's how you tell it to appear. How do you want it to appear?

I want the LCD and Serial Monitor just showing the RFID tag/card number. (only the number below the number that i mark with yellow)
Can you give me solution on how to do it, and what coding should i modify?

Quote
Serial.print()ing an int causes it to be converted to a string. Serial.print() of a char that contains the same value as the int will produce quite different output, and I suspect that is the output you are expecting.

Dont really know what u mean, can u explain it or show me the example with my coding?

Quote
Unlikely, since you appear to have the LCD connected to pin 9, too.
You have not declared pin 9 to be an output, nor do you have any code that affects pin 9.

So i need to declare other pin as a output for buzzer? and how do i make the buzer to beep when the RFID tag/card is touch?

Thanks in advance.






PaulS

#3
Oct 04, 2012, 08:22 pm Last Edit: Oct 04, 2012, 08:40 pm by PaulS Reason: 1
Quote
Can you give me solution on how to do it, and what coding should i modify?

Sure. It's really simple. Change this:
Code: [Select]
 int incomingByte;
to this:
Code: [Select]
 char incomingByte;

Code: [Select]
   }//no ; here
Fine. So, why is there one here?
Code: [Select]
     };
after the else?

Quote
So i need to declare other pin as a output for buzzer?

Yes.

Quote
and how do i make the buzer to beep when the RFID tag/card is touch?

The right card or the wrong card?

wizdum

I suggest you look at some of the examples in the playground here. You seem to have skipped over the basics of how to turn pins on/off, and jumped right into reading RFID tags. Its going to be a lot less confusing and time consuming if you learn the basics first.
"Anyone who isn't confused really doesn't understand the situation."

Electronic props for Airsoft, paintball, and laser tag -> www.nightscapetech.com

Go Up