Hi there
, I am trying to use an NFC shield on an Arduino Uno R3. I also installed the required libraries.
But when I try to verify my program with the NFC libraries, I get an error. Does someone know what I am doing wrong? I've included screenshots, which provide more information.
My code:
#include "Wire.h"
#include "PN532_I2C.h"
#include "PN532.h" // The following files are included in the libraries Installed
#include "NfcAdapter.h"
#define RESET (3)
PN532_I2C pn532_i2c(Wire);
NfcAdapter nfc = NfcAdapter(pn532_i2c); // Indicates the Shield you are using
void setup() {
Serial.begin(9600);
Serial.println("NFC Tag Writer"); // Serial Monitor Message
nfc.begin();
}
void loop() {
Serial.println("\nPlace an NFC Tag that you want to Record these Messages on!"); // Command for the Serial Monitor
if (nfc.tagPresent()) {
NdefMessage message = NdefMessage();
message.addTextRecord("My First NFC Tag Write"); // Text Message you want to Record
message.addUriRecord("http://allaboutcircuits.com"); // Website you want to Record
message.addTextRecord("Way to Go, It Worked!"); // Ednding Message for you to Record
boolean success = nfc.write(message);
if (success) {
Serial.println("Good Job, now read it with your phone!"); // if it works you will see this message
} else {
Serial.println("Write failed"); // If the the rewrite failed you will see this message
}
}
delay(10000);
}
(MOD EDIT)
Error messages are best copied and pasted into either code tags or quotes.
Very hard to read in pictures.
Just for future reference.
Bob.
Multiple libraries were found for "NdefMessage.h"
Used: C:\Users\Gebruiker\Documents\Arduino\libraries\NFC
Multiple libraries were found for "Wire.h"
Used: C:\Program
Multiple libraries were found for "PN532_I2C.h"
Used: C:\Users\Gebruiker\Documents\Arduino\libraries\PN532_I2C
Multiple libraries were found for "PN532Interface.h"
Used: C:\Users\Gebruiker\Documents\Arduino\libraries\Interface
Not used: C:\Users\Gebruiker\Documents\Arduino\libraries\PN532
In file included from C:\Users\Gebruiker\Documents\Arduino\libraries\NFC/NdefMessage.h:5:0,
Multiple libraries were found for "PN532.h"
from C:\Users\Gebruiker\Documents\Arduino\libraries\Tag/NfcTag.h:6,
Used: C:\Users\Gebruiker\Documents\Arduino\libraries\PN532
Multiple libraries were found for "NfcAdapter.h"
Used: C:\Users\Gebruiker\Documents\Arduino\libraries\Adapter
from C:\Users\Gebruiker\Documents\Arduino\libraries\Adapter/NfcAdapter.h:6,
Multiple libraries were found for "NfcTag.h"
Used: C:\Users\Gebruiker\Documents\Arduino\libraries\Tag
from C:\Users\Gebruiker\Documents\Arduino\NFC_Write\NFC_Write.ino:4:
C:\Users\Gebruiker\Documents\Arduino\libraries\NFC/NdefRecord.h:4:10: fatal error: Due.h: No such file or directory
#include <Due.h>
^~~~~~~
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Uno.
One of the libs you are calling looks like it was specifically for the Arduino DUE which uses a different architecture to the UNO.
If you don't have a DUE then find and kill that one.
It can be daunting finding correct libraries and I often resort to the internet and particularly project that use exactly the same hardware approach to give me a better chance at success.
Bob.