please help...please..............
i have project to interface active RFID with Arduino.
I already success to read unique code of active RFID tag in Arduino's serial monitor. and the unique code are :
tag 1 : $1C1503110663,01,0010603F, 00
tag 2 : $1C1503110663,01,00106062, 71
tag 3 : $1C1503110663,01,00106054, 74
tag 4 : $1C1503110663,01,00106038, 7E
and want to make if Tag 1 is losing from the Reader area, LED1 will turn ON
if Tag 2 is losing from Reader area, LED2 will turn ON. and continue until tag 4.
just simple , if one of them or just one is not detected by Reader , LED will turn on. but i cant do that. what's wrong with my listing program.. ? maybe you know what i miss ...
i already use these code in my Arduino program, but still not success.
this is my listingprogram :
[
#include <SoftwareSerial.h>
#define A_TAG_CODE "$1C1503110663,01,0010603F,00" //change this ID with your own card TAG
#define B_TAG_CODE "$1C1503110663,01,00106062,71"
#define C_TAG_CODE "$1C1503110663,01,00106054,74"
#define D_TAG_CODE "$1C1503110663,01,00106038,7E"
String msg;
SoftwareSerial RFID(9, 10);
#define ledpin 6
int ledPin = 6; //Sets pin 13 to LED
void setup()
{
pinMode(ledPin, OUTPUT); // Sets the digital pin as output
digitalWrite(ledpin,LOW);
Serial.begin(38400);
Serial.println("Serial READY");
RFID.begin(38400);
Serial.println("RFID READY");
}
char c;
void loop(){
msg="";
while(msg.length()<26){
while(RFID.available()>0){
msg += c;
Serial.write(RFID.read());
//Serial.println(msg); //Uncomment to view your tag ID
//Serial.println(msg.length());
}
}
msg=msg.substring(1,26);
if(msg.indexOf(A_TAG_CODE)>=0) add1 () ;
else add () ;
if(msg.indexOf(B_TAG_CODE)>=0) add1 () ;
else add () ;
if(msg.indexOf(C_TAG_CODE)>=0) add1 () ;
else add () ;
if(msg.indexOf(D_TAG_CODE)>=0) add1 () ;
else add () ;
}
void add () {
digitalWrite(ledPin, HIGH); // sets the LED off
}
void add1 () {
digitalWrite(ledPin, LOW); // sets the LED on
delay(2000); // waits for a second
}]
Please some body help....please....