Hello, I have an Arduino Wifi Rev2 and an Seeduino Grove NFC V1.1 to read some NFC cards.
I have no experience in programming with Arduino and I need some help to get this combination working.
This is the Instruction I am working with: this
This is the code of the Sktech I am using:
#include <NfcAdapter.h>
#include <PN532/PN532/PN532.h>
#if 0 // use SPI
#include <SPI.h>
#include <PN532/PN532_SPI/PN532_SPI.h>
PN532_SPI pn532spi(SPI, 9);
NfcAdapter nfc = NfcAdapter(pn532spi);
#elif 1 // use hardware serial
#include <PN532/PN532_HSU/PN532_HSU.h>
PN532_HSU pn532hsu(Serial1);
NfcAdapter nfc(pn532hsu);
#elif 0 // use software serial
#include <PN532/PN532_SWHSU/PN532_SWHSU.h>
#include "SoftwareSerial.h"
SoftwareSerial SWSerial(2, 3);
PN532_SWHSU pn532swhsu(SWSerial);
NfcAdapter nfc(pn532swhsu);
#else //use I2C
#include <Wire.h>
#include <PN532/PN532_I2C/PN532_I2C.h>
PN532_I2C pn532_i2c(Wire);
NfcAdapter nfc = NfcAdapter(pn532_i2c);
#endif
void setup(void) {
SERIAL.begin(9600);
SERIAL.println("NDEF Reader");
nfc.begin();
}
void loop(void) {
SERIAL.println("\nScan a NFC tag\n");
if (nfc.tagPresent()) {
NfcTag tag = nfc.read();
tag.print();
}
delay(5000);
}
I have to admit that I dont understand this code I have never seen this kind of if else statements in my life and I dont know when the program is using which case.
If I follow these instructions I get this error
Code: [[Select]](javascript:void(0)
C:\Users\alexa\Documents\Arduino\libraries\NDEF\src\PN532\PN532_I2C\PN532_I2C.cpp: In member function 'int8_t PN532_I2C::readAckFrame()':C:\Users\alexa\Documents\Arduino\libraries\NDEF\src\PN532\PN532_I2C\PN532_I2C.cpp:221:72: error: call of overloaded 'requestFrom(int, unsigned int)' is ambiguous if (_wire->requestFrom(PN532_I2C_ADDRESS, sizeof(PN532_ACK) + 1)) ^In file included from C:\Users\alexa\Documents\Arduino\libraries\NDEF\src/PN532/PN532_I2C/PN532_I2C.h:8:0, from C:\Users\alexa\Documents\Arduino\libraries\NDEF\src\PN532\PN532_I2C\PN532_I2C.cpp:5:C:\Users\alexa\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\libraries\Wire\src/Wire.h:60:13: note: candidate: virtual uint8_t TwoWire::requestFrom(uint8_t, size_t) uint8_t requestFrom(uint8_t, size_t); ^~~~~~~~~~~C:\Users\alexa\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\libraries\Wire\src/Wire.h:62:13: note: candidate: uint8_t TwoWire::requestFrom(int, int) uint8_t requestFrom(int, int); ^~~~~~~~~~~
I understand that there are different ways to read a NFC card I2C; UART maybe more?
But I dont know the differences neither which one I need to achieve my goal (reading a NFC card I dont care how the program does it I only need the informations given on the card)
Does anybody of you has an easy fix for a complete beginner with this kind of stuff so I can get the code working? Note I have never programmed anything in Arduino.
For me it looks like the compiler does have a problem with I2C… If I can get the program working without I2C I would take it I only have no idea how to accomplish it.
Could anybody of you give me some help?
kindly regards
Alex