Hi,
We have modified your code please let us know if it helps.
[code]#include <Ethernet2.h>
#include <SPI.h>
#include “PN532_SPI.h”
#include “PN532.h”
#include “NfcAdapter.h”
// ottona: default pin is 10, this one here is needed for the leonardo eth
PN532_SPI interface(SPI, 9); // create a PN532 SPI interface with the SPI CS terminal located at digital pin 9
NfcAdapter nfc = NfcAdapter(interface); // create an NFC adapter object
byte mac[] = { 0x90, 0xA2, 0xDA, 0x10, 0x1B, 0x97 };
byte server[] = { 192, 168, 5, 76 };
byte myip[] = { 192, 168, 5, 115 };
void setup(void) {
Serial.begin(115200); // begin serial communication
Serial.println(“NDEF Reader”);
delay(1000);
pinMode(4, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
digitalWrite(4, HIGH); //Always disable SD card SPI
digitalWrite(10, LOW); //Enable ETh
digitalWrite(9, HIGH); //Disable NFC
Ethernet.begin(mac, myip);
Serial.println(Ethernet.localIP());
digitalWrite(10, HIGH); //Disable ETh
digitalWrite(9, LOW); // Enable NFC
nfc.begin(); // begin NFC communication
}
void loop(void) {
Serial.println("\nScan an NFC tag\n");
if (nfc.tagPresent()) // Do an NFC scan to see if an NFC tag is present
{
NfcTag tag = nfc.read(); // read the NFC tag into an object, nfc.read() returns an NfcTag object.
tag.print(); // prints the NFC tags type, UID, and NDEF message (if available)
}
digitalWrite(9, HIGH); // disable nfc shield
digitalWrite(10, LOW); // enable networking
Ethernet.begin(mac, myip);
EthernetUDP udp;
udp.beginPacket(server, 44789);
udp.write("TESTMSG"/*tag.getUidString()*/);
udp.endPacket();
delay(500); // wait half a second (500ms) before scanning again (you may increment or decrement the wait time)
digitalWrite(10, HIGH); // disable networking
digitalWrite(9, LOW); // enable nfc shield
nfc.begin(); // begin NFC communication
}[/code]