Playground Arduino CC Learning PRFID
Playground Arduino CC Learning PRFID
Home
Buy
Download
Products
L earning
Forum
Support
Blog
L OG IN
SIGN UP
This code lets the Arduino read the Parallax brand RFID reader. Once connected and
programmed, prints the tag number in the serial monitor window. Note that the serial
monitor window runs at an astonishing 2400 baud, so make sure you have your seat belt
buckled!
- Libraries
- Tutorials
- Arduino RX to RFID TX
Electronics Technique
pdfcrowd.com
Initiatives
Arduino People/Groups & Sites
Exhibition
Project Ideas
Languages
int val = 0;
char code[10];
int bytesread = 0;
void setup() {
PARTICIPATE
- Suggestions
- Formatting guidelines
- All recent changes
- PmWiki
- WikiSandBox training
void loop() {
- Basic Editing
- Cookbook (addons)
if(Serial.available() > 0) {
// if data available from reader
if((val = Serial.read()) == 10) {
// check for header
bytesread = 0;
while(bytesread<10) {
// read 10 digit code
if( Serial.available() > 0) {
val = Serial.read();
if((val == 10)||(val == 13)) { // if header or stop bytes before the 10 digit reading
break;
// stop reading
}
code[bytesread] = val;
// add the digit
bytesread++;
// ready to read next digit
}
}
if(bytesread == 10) {
// if 10 digit read is complete
Serial.print("TAG code is: ");
// possibly a good TAG
Serial.println(code);
// print the TAG code
}
bytesread = 0;
digitalWrite(2, HIGH);
// deactivate the RFID reader for a moment so it will not flood
delay(1500);
// wait for a bit
digitalWrite(2, LOW);
// Activate the RFID reader
}
}
- Documentation index
- Drone with Arduino
- Thermostat with Arduino
}
// extra stuff
// digitalWrite(2, HIGH);
pdfcrowd.com
void loop()
{
SoftwareSerial RFID = SoftwareSerial(rxPin,txPin);
RFID.begin(2400);
if((val = RFID.read()) == 10)
{
// check for header
bytesread = 0;
while(bytesread<10)
{ // read 10 digit code
val = RFID.read();
if((val == 10)||(val == 13))
{ // if header or stop bytes before the 10 digit reading
break;
// stop reading
}
code[bytesread] = val;
// add the digit
bytesread++;
// ready to read next digit
}
pdfcrowd.com
if(bytesread == 10)
{ // if 10 digit read is complete
Serial.print("TAG code is: ");
// possibly a good TAG
Serial.println(code);
// print the TAG code
}
bytesread = 0;
delay(500);
// wait for a second
}
}
Share
NEWSLETTER
Enter your email to sign up
2014 Arduino
Copyright Notice
Contact us
pdfcrowd.com