Request PN532 RFID/NFC Shield HSU for arduino error question

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
fasionmo
 
Posts: 5
Joined: Tue Jun 10, 2014 3:57 am

Request PN532 RFID/NFC Shield HSU for arduino error question

Post by fasionmo »

Request PN532 RFID/NFC Shield HSU for arduino error question?
I'm trying to figure out how to use the PN532 shield HSU mode (SEL0 is open and SEL1 is closed).
I just can't find the source of the error. Below is the error status and my code. Am I missing something simple?

Complete program code is following:

Code: Select all

// choose to SPI or I2C or HSU
#if 0
  #include <SPI.h>
  #include <PN532_SPI.h>
  #include "PN532.h"

  PN532_SPI pn532spi(SPI, 10);
  PN532 nfc(pn532spi);
#elif 0
  #include <PN532_HSU.h>
  #include <PN532.h>
      
  PN532_HSU pn532hsu(Serial1);
  PN532 nfc(pn532hsu);
#else 
  #include <Wire.h>
  #include <PN532_I2C.h>
  #include <PN532.h>

  PN532_I2C pn532i2c(Wire);
  PN532 nfc(pn532i2c);
#endif

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);
  
  // Set the max number of retry attempts to read from a card
  // This prevents us from waiting forever for a card, which is
  // the default behaviour of the PN532.
  nfc.setPassiveActivationRetries(0xFF);
  
  // configure board to read RFID tags
  nfc.SAMConfig();
    
  Serial.println("Waiting for an ISO14443A card");
}

void loop(void) {
  boolean 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)
  
  // Wait for an ISO14443A type cards (Mifare, etc.).  When one is found
  // 'uid' will be populated with the UID, and uidLength will indicate
  // if the uid is 4 bytes (Mifare Classic) or 7 bytes (Mifare Ultralight)
  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(" 0x");Serial.print(uid[i], HEX); 
    }
    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");
  }
}
Attachments
123.jpg
123.jpg (278.17 KiB) Viewed 1557 times
Last edited by adafruit_support_bill on Tue Jun 10, 2014 7:28 am, edited 1 time in total.
Reason: please use the </> button when submitting code. press </>, then paste your code between the [code] [/code] tags.

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

Re: Request PN532 RFID/NFC Shield HSU for arduino error ques

Post by adafruit_support_bill »

Please post the text of the error messages. Your screen image is too small to read.

fasionmo
 
Posts: 5
Joined: Tue Jun 10, 2014 3:57 am

Re: Request PN532 RFID/NFC Shield HSU for arduino error ques

Post by fasionmo »

Sorry,i take a photograph is not good.
Attachments
未命名.jpg
未命名.jpg (158.88 KiB) Viewed 1534 times

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

Re: Request PN532 RFID/NFC Shield HSU for arduino error ques

Post by adafruit_support_bill »

The "does not name a type" error means that the compiler was not able to locate the library in the expected location. Make sure that your library is installed according to these directions: http://learn.adafruit.com/adafruit-all- ... nstall-use

fasionmo
 
Posts: 5
Joined: Tue Jun 10, 2014 3:57 am

Re: Request PN532 RFID/NFC Shield HSU for arduino error ques

Post by fasionmo »

adafruit_support_bill:
Excuse me.
I'm sure my library is correct.
My library direction following figure.
I'm willing to provide examples file:PN532-PN532_HSU.zip
Attachments
未命名.jpg
未命名.jpg (102.44 KiB) Viewed 1530 times
PN532-PN532_HSU.zip
(38.71 KiB) Downloaded 89 times

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

Re: Request PN532 RFID/NFC Shield HSU for arduino error ques

Post by adafruit_support_bill »

That is not one of our libraries. You might try contacting the author.

The zip file appears to have an extra level of directory folders in it. You can try pulling the folder you need out to the top level of your Libraries folder.

fasionmo
 
Posts: 5
Joined: Tue Jun 10, 2014 3:57 am

Re: Request PN532 RFID/NFC Shield HSU for arduino error ques

Post by fasionmo »

OK,I tried to contact him.
Thanks.
Talk with you that I learned a lot.

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

Return to “Arduino Shields from Adafruit”