WL125 RFID Pet feeder help

I did not test this, but you can try to see what happend.
if it does not compile, check spelling or capitoalizaton.

#include <Wiegand.h>

WIEGAND Wiegand;


//Declaration of pins
#define WiegandData0 0
#define WiegandData1 1
unsigned long Tag1 = 0014070465;
unsigned long Tag2 = 0014909682;

void setup() {
  Serial.begin(9600);

//define the Wiegand Pins in the begin
  Wiegand.begin(WiegandData1, WiegandData0);
}

void loop()
{
  if (Wiegand.available())
  {
//    Serial.print("Tag Detected: 00");
unsigned long TagDetected  = Wiegand.getCode());
	if(TagDetected = Tag1 ) {    //  op's    ==
		  Serial.println( "CAT A DETECTED");
	}
	if(TagDetected = Tag2 ) {   //  op's    ==
		  Serial.println( "CAT B DETECTED");
	}
  }
} // === END LOOP ====

if this does work, then the next step is to tell the motors to move.

Unfortunately this doesnt work for me, When scanning a tag I get a response for both

20:07:21.166 -> CAT A DETECTED
20:07:21.166 -> CAT B DETECTED

In a stroke of desperation I changed the = tag1 to == tag 1 and that worked.
OMG I could melt I am so relieved.

1 Like

Thank you so much for the assistance guys, will touch back in a day or two when I inevitably get stuck on the servo code.

Can you post the code you used?

Pretty much exactly as @dave-in-nj used, just changed the names.

#include <Wiegand.h>

WIEGAND Wiegand;
//Declaration of pins
#define WiegandData0 0
#define WiegandData1 1
unsigned long sherTag = 14070465;
unsigned long watsTag = 14909682;

void setup() {
  Serial.begin(9600);

  //define the Wiegand Pins in the begin
  Wiegand.begin(WiegandData1, WiegandData0);
}

void loop()
{
  if (Wiegand.available())
  {
    unsigned long TagDetected  = Wiegand.getCode();
    if (TagDetected == sherTag )
    {
      Serial.println( "Sherlock Detected");
    }
    if (TagDetected == watsTag )
    {
      Serial.println( "Watson Detected");
    }
  }
} // === END LOOP ====