Why cant it be reconized? MFRC522 libary

#include <MFRC522.h>

I imported the library, but it wont get recognized. Is it something i missing?

@ssjNot2201, a few more details would be good:

  • What tool are you using - Web IDE, Workbench, Particle CLI?
  • Which DeviceOS are you building to?
  • When you say import, do you mean added, copied, installed?
  • When you say “it won’t get recognized”, what do you mean by that? Any error messages?

Sorry, let me try again :sweat_smile:

I am using Workbench (VSCODE).

device os is 20.1 I think (photon).

What I mean by i import, I mean installed.

I am trying to build a project where you read the RFID tag and some form for functionality get activated by it. I have the Tag from the card, but it dosent work.

Have you used the respective task to install the library (after you created a project)
image
image

Yes, I have. and I can see the library. but still it’s not recognized. :disappointed:

Is it not compiling or is only “IntelliSense” complaining?
IntelliSense warnings can be safely ignored as long the actual build is not affected.
I just created a new project, imported the library, used one of the provided samples and that built just fine.

This is my project tree (including the build output in target)

C:.
│   project.properties
│   README.md
│
├───.vscode
│       launch.json
│       settings.json
│
├───lib
│   └───MFRC522
│       │   library.properties
│       │   LICENSE
│       │   README.md
│       │
│       ├───.git
│       ├───examples
│       │   ├───DumpInfo
│       │   │       DumpInfo.ino
│       │   │
│       │   ├───MifareClassicValueBlock
│       │   │       MifareClassicValueBlock.ino
│       │   │
│       │   └───ReadAndWrite
│       │           ReadAndWrite.ino
│       │
│       └───src
│           │   MFRC522.cpp
│           │   MFRC522.h
│           │
│           └───MFRC522
│                   MFRC522.h
│
├───src
│       MFC_Test.cpp
│       MFC_Test.ino
│
└───target
    └───2.0.1
        └───photon
            │   MFC_Test.bin
            │   MFC_Test.bin.crc_block
            │   MFC_Test.bin.no_crc
            │   MFC_Test.elf
            │   MFC_Test.hex
            │   MFC_Test.lst
            │   MFC_Test.map
            │
            └───obj
                └───src
                        module_info.o
                        module_info.o.d
                        newlib_stubs.o
                        newlib_stubs.o.d
                        user_export.o
                        user_export.o.d
                        user_module.o
                        user_module.o.d

The only output i have from intelliSense is this:

[3/6/2021, 6:13:27 PM] For C++ source files, IntelliSenseMode was changed from “macos-gcc-x64” to “macos-gcc-arm”

This is what it says when hovering over the problem:

#include errors detected based on information provided by the configurationProvider setting. Squiggles are disabled for this translation unit

I have another question too. I know the uid of the rfid cards, how shall i use it as a key? like “The pc starts if the uid is the as one hardcoded in the program”?

This error message points at IntelliSense.
Just try building via Ctrl+Shift+B
image

You just have to compare each byte of the UUID of the card read by the reader against your known UUID and when it matches do one thing when not another.
What these actions are depends on your use-case, we cannot advise on that :wink:

Thank you!

Is it a way to encrypt the values ? or to not hardcode them?

I would not hardcode the UUIDs, no matter whether encrypted or not.
I’d send them to the device via a Particle.function() call and then store them in EEPROM.
If you want to encrypt them before storing them in EEPROM you’d need to do that in your code.

Can i get a example? I understood that EEPROM is place where you can store data, but how will the public function go in here? maybe I am overthinling this🤔

You create a function that takes in a string - which you send remotely.
This string gets parsed (e.g. via sscanf()) and converted into your desired format (e.g. raw bytes or encrypted) and that data packet can be stored via EEPROM.put() into EEPROM.

When you later want to check a read UUID against that stored UUID you'd just read it back from EEPROM via EEPROM.get().

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.