Programming For Touchless Panel: Char Char
Programming For Touchless Panel: Char Char
Programming For Touchless Panel: Char Char
#define RELAYPIN 13
#define WARNLEDPIN 12
char tag[] ="51005F46642C"; // Replace with your own Tag ID
char input[12]; // A variable to store the Tag ID being
presented
int count = 0; // A counter variable to navigate through
the input[] character array
boolean flag = 0; // A variable to store the Tag match status
void setup()
{
Serial.begin(9600); // Initialise Serial Communication with the
Serial Monitor
pinMode(RELAYPIN,OUTPUT); // RELAY OUTPUT
pinMode(WARNLEDPIN,OUTPUT); //WRONG TAG INDICATOR
}
void loop()
{
if(Serial.available())// Check if there is incoming data in the RFID Reader
Serial Buffer.
{
count = 0; // Reset the counter to zero
/* Keep reading Byte by Byte from the Buffer till the RFID Reader Buffer
is empty
or till 12 Bytes (the ID size of our Tag) is read */
while(Serial.available() && count < 12)
{
input[count] = Serial.read(); // Read 1 Byte of data and store
it in the input[] variable
count++; // increment counter
delay(5);
}
/* When the counter reaches 12 (the size of the ID) we stop and compare
each value
of the input[] to the corresponding stored value */
if(count == 12) //
{
count =0; // reset counter varibale to 0
flag = 1;
/* Iterate through each value and compare till either the 12
values are
all matching or till the first mistmatch occurs */
while(count<12 && flag !=0)
{
if(input[count]==tag[count])
Programming for Touchless panel