problem with RFID library

downloaded and installed the RFID folder in my documents
no errors occuring when checking syntax
problem is that the RFID word stays in black and doesn’t turn orange like it should do

“RFID does not name a type” even with the library installed

i’am using an arduino nano and a RFID RC522

here’s the code :

#include <SPI.h>
#include <RFID.h>
#include <Servo.h>
#include “pitches.h”
#include <Wire.h>

#define SS_PIN 10
#define RST_PIN 5

// definition of the RFID
RFID rfid(SS_PIN, RST_PIN);

byte rfidmipo[5] = {0xCD,0x71,0xE1,0x6F,0x32};
byte rfidnum2[5] = {0x44,0xCB,0x94,0x5B,0x40};
// put your other cards allowed here

byte serNum[5];
byte data[5];

// definition of melodies access / welcome and rejection / error
int access_melody = {NOTE_A4,0,NOTE_A4,0};
int access_noteDurations = {8,8,8,8,8,4,8,8,8,8,8,4};
int fail_melody = {NOTE_G2,0,NOTE_D2,0};
int fail_noteDurations = {8,8,8,8,8,4};

// define pins of the LED, Buzzer and Servo-motor
int LED_access = 2;
int LED_denied = 3;
int speaker_pin = 8;
int servoPin = 9;

// define servo-motor
Servo doorLock;

void setup(){
doorLock.attach(servoPin); // link servo motor to pin
Serial.begin(9600); // initialize serial communication
SPI.begin(); // initialize SPI communication for RFID
rfid.init(); // initialize the RFID
delay(1000);
pinMode(LED_access,OUTPUT);
pinMode(LED_denied,OUTPUT);
pinMode(speaker_pin,OUTPUT);
pinMode(servoPin,OUTPUT);
}

void loop(){

// Create a variable for each user
boolean rfidmipo_card = true; // my card

if (rfid.isCard()){ // found valid card
if (rfid.readCardSerial()){ // reads the card
delay(1000);
data[0] = rfid.serNum[0]; // stores the serial number
data[1] = rfid.serNum[1];
data[2] = rfid.serNum[2];
data[3] = rfid.serNum[3];
data[4] = rfid.serNum[4];
}

//rfid.halt(); // RFID to standby
if(data[0] < 16){
Serial.print(“0”);
}
Serial.print(data[0],HEX);

if(data[1] < 16){
Serial.print(“0”);
}
Serial.print(data[1],HEX);

if(data[2] < 16){
Serial.print(“0”);
}
Serial.print(data[2],HEX);

if(data[3] < 16){
Serial.print(“0”);
}
Serial.print(data[3],HEX);

if(data[4] < 16){
Serial.print(“0”);
}
Serial.print(data[4],HEX);
for(int i=0; i<5; i++){
if(data != rfidmipo*) rfidmipo_card = false; // if not my card, poses as fake. Here you can check the other cards allowed*
* }*
* Serial.println();*
* if (rfidmipo_card){ // A card found*
* Serial.print(“Hello Michael.”); //Serial.println(“Hello Michael!”); // print message*
* }*
* else{ // if an unknown card is scanned*
* Serial.print(“Card not recognized. Access denied.”); // Prints message*
* digitalWrite(LED_denied, HIGH); //Red LED lights up*
* delay(1000); // waiting*
* digitalWrite(LED_denied, LOW); // red LED goes out*
* }*
* if (rfidmipo_card){// add other users with a logical or Welcome message and access permission*
* Serial.print(" Access Granted.");*
* digitalWrite(LED_access,HIGH); // green LED lights up*
* doorLock.write(180); // door releases*
* delay(5000); // waiting*
* doorLock.write(0); // gate Latch*
* digitalWrite(LED_access,LOW); // green LED goes out*
* }*
* Serial.println();*
* delay(500);*
* rfid.halt();*
* }*
}

and here’s the library in downloads
please help !
RFID.h.h (6.1 KB)
RFID.cpp (12.3 KB)
keywords.txt (3.88 KB)

"RFID does not name a type" even with the library installed

The RFID.h.h file? Why does it have two .hs? Where did you install the library?

my bad on the double .h i copied linked even with the simple .h file it doesnt works
they are in my documents > arduino > libraries

maybe you can try yourself to tell me if its working for you ?

RFID.h.h (6.1 KB)

RFID.cpp (12.3 KB)

keywords.txt (771 Bytes)

maybe you can try yourself to tell me if its working for you ?

I would, except that you posted your sketch incorrectly, so the forum software mangled it for you. Modify your post, after reading the two stickies at the top of this forum, and then I'll be able to.

here you go, i post everything in attachments

RFID.h.h (6.1 KB)

RFID.cpp (12.3 KB)

keywords.txt (771 Bytes)

rfiddoorlock.ino (2.89 KB)

I created a folder called RFID, in the libraries folder my sketchbook folder. I copied RFID.h and RFID.cpp to it.

I opened the IDE and pasted the sketch. When I Verify, I get:

sketch_mar31a.ino:5:21: error: pitches.h: No such file or directory sketch_mar31a:23: error: 'NOTE_A4' was not declared in this scope sketch_mar31a:23: error: 'NOTE_A4' was not declared in this scope sketch_mar31a:25: error: 'NOTE_G2' was not declared in this scope sketch_mar31a:25: error: 'NOTE_D2' was not declared in this scope

Nothing about RFID not naming a type (because it does).

your error is because you don’t have the pitches.h

when you add a library, the name should be orange no ? in my sketch all the RFID and rifd words stay black
that’s the case for the #include <RFID.h> this word should be in orange (i’am new in coding so sorry :slight_smile: )

i don’t get any errors also but the thing is the rfid reader isn’t working because i think the library isn’t working

when you add a library, the name should be orange no ?

Sometimes. It's no indication that anything useful is happening, though.

because i think the library isn't working

So, don't use it. Write your own damned code. You don't think that maybe wiring it up incorrectly might be an issue? Where did you get the library? Which Arduino do you have? How IS the device connected?

PaulS:

when you add a library, the name should be orange no ?

Sometimes. It's no indication that anything useful is happening, though.

because i think the library isn't working

So, don't use it. Write your own damned code. You don't think that maybe wiring it up incorrectly might be an issue? Where did you get the library? Which Arduino do you have? How IS the device connected?

i cannot write my own code because i don't have any knowledge in this, otherwise i won't be asking for help wiring is correct, on nano

Reset > Pin 5 SS or SDA > Pin 10 MOSI > Pin 11 MISO > Pin 12 SCK > Pin 13 Ground > Ground 3.3v > 3.3v

LED Green > Pin 2 > GND LED Red > Pin 3 > GND Speaker > Pin 8 > GND Servo > Pin 9 > GND

RSt and SS are set in the code setting too

i think i found what's wrong but i cannot fix it. si i declare in the code RFID rfid(10,5) for the pins used then in void setup i have the rfid.init that's what isn't working init is not recognized as a command ans stays in black, so the device isn't starting

wiring is correct, on nano

I'm not willing to take your word for this. If the wiring was correct, the device would be working, wouldn't it?

Provide a link to the RFID reader you are using and a photo of the wiring. Make sure the wiring is neat, that all the wires are different colors, that the lighting is good, and that the focus is good.

wht r u trying to do with this project? explain concept ?