i have added a sketch. (note that didnt have my rfid so i added something else in place) i use the rdw6300 rfid module.
arduino 1 (rfid reader code)
#include <SoftwareSerial.h>
SoftwareSerial RFID(2, 3);
int data1 = 0;
int ok = -1;
int yes = 12;
int tag1[14] = {2, 52, 66, 48, 48, 68, 66, 56, 48, 68, 53, 67, 53, 3};
int tag2[14] = {2, 52, 66, 48, 48, 51, 49, 68, 69, 48, 54, 65, 50, 3};
int tag3[14] = {2, 52, 66, 48, 48, 51, 49, 68, 65, 66, 56, 49, 56, 3};
int newtag[14] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // used for read comparisons
void setup()
{
RFID.begin(9600); // start serial to RFID reader
Serial.begin(9600); // start serial to PC
pinMode(yes, OUTPUT); // for status LEDs
pinMode(no, OUTPUT);
pinMode(green, OUTPUT); // for status LEDs
boolean comparetag(int aa[14], int bb[14])
{
boolean ff = false;
int fg = 0;
for (int cc = 0 ; cc < 14 ; cc++)
{
if (aa[cc] == bb[cc])
{
fg++;
}
}
if (fg == 14)
{
ff = true;
}
return ff;
}
void checkmytags() // compares each tag against the tag just read
{
ok = 0; // this variable helps decision-making,
// if it is 1 we have a match, zero is a read but no match,
// -1 is no read attempt made
if (comparetag(newtag, tag1) == true)
{
ok++;
}
if (comparetag(newtag, tag2) == true)
{
ok++;
}
if (comparetag(newtag, tag3) == true)
{
ok++;
}
}
void readTags()
{
ok = -1;
if (RFID.available() > 0)
{
delay(200);
for (int z = 0 ; z < 14 ; z++)
{
data1 = RFID.read();
newtag[z] = data1;
}
RFID.flush();
checkmytags();
}
if (ok > 0) // if we had a match
{
Serial.println("Accepted");
digitalWrite(yes, HIGH);
delay(500);
digitalWrite(yes, LOW);
ok = -1;
delay(200);
}
else if (ok == 0) // if we didn't have a match
{
Serial.println("Rejected");
ok = -1;
delay(200);
}
}
void loop()
{
readTags();
}
and on arduino 2 a simple (for now)
const int Led = 6;
const int arduino1 = 12;
int buttonState = 0;
void setup() {
pinMode(12, INPUT);
pinMode(6, OUTPUT);
pinMode(4, OUTPUT);
}
void loop() {
buttonState = digitalRead(arduino1);
if (buttonState == HIGH) {
digitalWrite(led, HIGH);
delay(1000);
digitalWrite(led, LOW);
}
else {
delay(200);
}
}
it seem to work ok but just though of getting a second opinion since i am very new to everything around arduino and electronics 