Arduino Mega 2560
|
NFC readers are used for reading data from RFID cards. These cards are radio frequency ID cards which can send data without battery. Electricity is generated in the cards from the electromagnetic field of the NFC reader. The cards can be used for authenticating persons or object. You can control both RC522 and PN532 NFC readers. You can learn more about RFID cards and NFC readers on the internet.
Required hardware
- Arduino Mega 2560
- NFC Reader(s)
Before you upload this code to your Arduino, please format the EEPROM...
RC522 source code to install on controller
#include <OzIDManager.h> #include <OzNfcReader.h> OzIDManager* manager; OzNfcReader *rc522reader; void setup() { Serial.begin(115200); SPI.begin(); manager = new OzIDManager; manager->_sendACK = true; manager->_checksum = true; OzCommunication::setIDManager(manager); rc522reader = new OzNfcReader(MODE::RC522, 10, 8); int x=1; manager->sendLinkSetup(); manager->PrintWelcomeLine(rc522reader, x++,"MyRC522Nfc"); } void loop() { OzCommunication::communicate(); rc522reader->ownLoop(); }
PN532 source code to install on controller
#include <OzIDManager.h> #include <OzNfcReader.h> OzIDManager* manager; OzNfcReader *pn532reader; void setup() { Serial.begin(115200); SPI.begin(); manager = new OzIDManager; manager->_sendACK = true; manager->_checksum = true; OzCommunication::setIDManager(manager); pn532reader = new OzNfcReader(MODE::PN532); int x=1; manager->sendLinkSetup(); manager->PrintWelcomeLine(pn532reader, x++,"MyPN532Nfc"); } void loop() { OzCommunication::communicate(); pn532reader->ownLoop(); }