NFC Shield "lockout"

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
carlosr
 
Posts: 25
Joined: Tue Nov 27, 2012 7:27 pm

NFC Shield "lockout"

Post by carlosr »

Hello,

Im using the NFC shield on an "extensive" code for a big project.

What i call lockout, is the act of keeping the tag next to the NFC shield, removing the delay, and not keep reading the tag over and over.

I have this in my loop cycle

Code: Select all

void SistemaEndradaRFID(struct TecladosMatriz& teclados)
{
boolean success;
uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 };
uint8_t uidLength;
success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, &uid[0], &uidLength);

	if (success) {
		Serial.println("Found a card!");
		Serial.print("UID Length: ");Serial.print(uidLength, DEC);Serial.println(" bytes");
		Serial.print("UID Value: ");
		for (uint8_t i=0; i < uidLength; i++) 
		{
		  Serial.print(uid[i], DEC); 

		}
		Serial.println("");
		// Wait 1 second before continuing
		delay(1000);
	  }
	  else
	  {
		// PN532 probably timed out waiting for a card
		Serial.println("Timed out waiting for a card");
	  }
}

I cant use any delay(), so i want to use a "lockout" similar to the "Button State Change".

I've used a similar code to this, if you are familiar with the analog keypad, but its not working.


How can I make the lockout?


Greetings

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: NFC Shield "lockout"

Post by adafruit_support_bill »

What i call lockout, is the act of keeping the tag next to the NFC shield, removing the delay, and not keep reading the tag over and over.
Not sure I understand. If you don't keep reading, how do you know that the tag is still there?

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”