I picked up arduino after a while and I decided to restart hard with some PN5180 readers. I am trying to get it to read the correct tag and activate a servo. I dont have the PN5180s yet they're in the mail but I'm getting a head start and can't compile or figure out this error code. I'm using ATrappmans PN5180 library.
C:\Users\lnico\OneDrive\Documents\Arduino\inital_pn8150\inital_pn8150.ino: In function 'void loop()':
inital_pn8150:67:30: error: request for member 'getInventory' in 'nfc', which is of non-class type 'PN5180ISO15693 [1]'
ISO15693ErrorCode rc = nfc.getInventory(thisUid);
^~~~~~~~~~~~
exit status 1
#include <PN5180.h>
#include <PN5180ISO15693.h>
#include "Servo.h"
#include <Wire.h>
/*
*/
const int ledred = 7;
const int ledgreen = 6;
// The number of PN5180 readers connected
const byte numReaders = 1;
// What is the "correct" UID that should be detected by each reader
uint8_t correctUid[][8] =
{
{0xD1,0xD2,0x48,0x2A,0x50,0x1,0x4,0xE0}, //TAG 1
{0xB,0x8A,0xC6,0x6A,0x0,0x1,0x4,0xE0} //TAG 2
};
//Default value when there is no tag
uint8_t noUid[][8] = {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}; //TAG 1}
// GLOBALS
// Each PN5180 reader requires unique NSS, BUSY, and RESET pins,
PN5180ISO15693 nfc[] = {
PN5180ISO15693(10,9,8), // Pins correspondants aux fonstions des lecteurs
};
int pos = 0;
Servo turnTable;
// Array to record the value of the last UID read by each reader
uint8_t lastUid[numReaders][8];
// the setup function runs once when you press reset or power the board
void setup() {
Serial.println("Reader 1");
Serial.begin(115200);
for(int i=0; i<numReaders; i++){
Serial.print("Reader #");
Serial.println(i);
Serial.println(F("Initialising..."));
nfc[i].begin();
Serial.println(F("Resetting..."));
nfc[i].reset();
Serial.println(F("Enabling RF field..."));
nfc[i].setupRF();
}
Serial.println(F("Setup Complete"));
}
void loop() {
for ( int i=0; i<numReaders; i++) {
uint8_t thisUid(8);
ISO15693ErrorCode rc = nfc.getInventory(thisUid);
if (rc == ISO15693_EC_OK){
if (memcmp(thisUid, lastUid, 8)==0){
continue; }
else{
memcpy(lastUid, thisUid, 0);
}
}
else{
if(lastUid[7]== 0xE0){
memset(lastUid, 0 ,8);
}
}
if (thisUid == correctUid){
for (pos = 0; pos <= 180; pos -= 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
turnTable.write(pos); // tell servo to go to position in variable 'pos'
delay(25); }
}
else {
turnTable.write(0);
}
}
}
lmk if theres formatting issues its my first post