#include #include #include #include "station.h" #define PN532_CS 10 PN532 nfc(PN532_CS); const int rs = 9, en = 8, d4 = 5, d5 = 4, d6 = 3, d7 = 2; LiquidCrystal lcd(rs, en, d4, d5, d6, d7); Station stations[4] = { Station(1680767519, "Yellow"), Station(3346823711, "Green"), Station(3569318175, "Pink"), Station(2174777887, "Blue") }; void setup(void) { setupNFC(); lcd.begin(16, 2); lcd.setCursor(0, 0); lcd.print("Test"); } void loop(void) { lcd.clear(); checkStations(); delay(1000); } void setupNFC() { nfc.begin(); uint32_t versiondata = nfc.getFirmwareVersion(); if (!versiondata) { while (1) ; // halt } // configure board to read RFID tags and cards nfc.SAMConfig(); } void checkStations() { Station* station = detectStation(); lcd.setCursor(0, 0); lcd.print("docked to station "); } Station* detectStation() { uint32_t id; id = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A); Station* found = 0; for (int i = 0; i < sizeof(stations); i++) { Station* currentStation = &stations[i]; if (id != 0) { if(currentStation->check(id)) { found = currentStation; } } } return found; }