parallax rfid code please help
first of start saying arduino nooby have found community helpful!
i found code read rfid codes online , works great when try turn led on when card read program not work. seems though should simple not seeing why code doesnt work please if can.
thank in advance help!
i found code read rfid codes online , works great when try turn led on when card read program not work. seems though should simple not seeing why code doesnt work please if can.
code: [select]
// modified worapoht k.
#include <softwareserial.h>
int val = 0;
char code[10];
int bytesread = 0;
char stephen[11]="8400338a85";
#define rxpin 5
#define txpin 9
// rfid reader sout pin connected serial rx pin @ 2400bps pin8
void setup()
{
serial.begin(2400); // hardware serial monitor 2400bps
pinmode(2,output); // set digital pin 2 output connect rfid /enable pin
pinmode(13,output);
digitalwrite(2, low); // activate rfid reader
}
void loop()
{
softwareserial rfid = softwareserial(rxpin,txpin);
rfid.begin(2400);
if((val = rfid.read()) == 10)
{ // check header
bytesread = 0;
while(bytesread<10)
{ // read 10 digit code
val = rfid.read();
if((val == 10)||(val == 13))
{ // if header or stop bytes before 10 digit reading
break; // stop reading
}
code[bytesread] = val; // add digit
bytesread++; // ready read next digit
}
if(bytesread == 10)
{ // if 10 digit read complete
serial.print("tag code is: "); // possibly tag
serial.println(code); // print tag code
}
bytesread = 0;
delay(500); // wait second
}
if(code==stephen)
{
digitalwrite(13,high);
}
} thank in advance help!
i take you've read this: http://arduino.cc/playground/learning/prfid
replace serial.print in example if statement see if it's right tag code, , digitalwrite(13, high); or something.
replace serial.print in example if statement see if it's right tag code, , digitalwrite(13, high); or something.
Arduino Forum > Using Arduino > Programming Questions > parallax rfid code please help
arduino
Comments
Post a Comment