3

Using an Uno configured with an Adafruit RFID-NFC shield to send the UID values to a desktop game I am building.

Works fine. However, in addition to just the UID, I need to send 1 additional value, lets call it 'game choice'. This can be one of 3 values. This is just the relevant code. Can any experts suggest how I might modify the following to send this additional value?

/**************************************************************************/
#include <Wire.h>
#include <Adafruit_NFCShield_I2C.h>

#define IRQ   (2)
#define RESET (3)  // Not connected by default on the NFC Shield

Adafruit_NFCShield_I2C nfc(IRQ, RESET);

void setup(void) {
  Serial.begin(115200);
  Serial.println("Hello!");

  nfc.begin();

  uint32_t versiondata = nfc.getFirmwareVersion();
  if (! versiondata) {
    Serial.print("Didn't find PN53x board");
    while (1); // halt
  }
  // Got ok data, print it out!
  Serial.print("Found chip PN5"); Serial.println((versiondata>>24) & 0xFF, HEX); 
  Serial.print("Firmware ver. "); Serial.print((versiondata>>16) & 0xFF, DEC); 
  Serial.print('.'); Serial.println((versiondata>>8) & 0xFF, DEC);

  // configure board to read RFID tags
  nfc.SAMConfig();

  Serial.println("init");
}
void loop(void) {
  uint8_t success;
  uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 };  // Buffer to store the returned UID
  uint8_t uidLength;                        // Length of the UID (4 or 7 bytes depending on ISO14443A card type)
  int nfcDEC;  
  success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);

  if (success) {


   nfc.PrintHex(uid, uidLength );
}
}
3
  • Could you elaborate on what you want to send, from where and to whom? Its not entirely clear.
    – asheeshr
    Commented Apr 3, 2014 at 14:01
  • The message is sent obviously whenever a user scans their tag over 1 of 3 possible scan targets(game choices). This 'game choice' value would be hardcoded. The receiving end is a desktop Adobe AIR application. Using the ArduinoConnector native Extension code.google.com/p/as3-arduino-connector
    – Bachalo
    Commented Apr 3, 2014 at 14:32
  • so 3 arduinos+3 shields, 1 used for each choice and COM port
    – Bachalo
    Commented Apr 3, 2014 at 14:41

1 Answer 1

1

had to simply modify PrintHex in Adafruit_NFCShield_I2C.h

to accept an additional argument

1
  • 4
    Could you explain a bit more on what you changed (show relevant code)? The answer in its current form isn't very useful to others having the same issue.
    – sachleen
    Commented Apr 4, 2014 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.