Arduino problem compilation rfid

Good evening, I’m new … I show up.
my name is Lorenzo am a boy of 18 years old and I attend the fifth year of higher education … I found it very adequate community for my purpose … now I ask you my problem.
I’m doing a sketch with RFID but now I get this error when compiling:
Arduino: 1.6.7 (Windows 10), detail: "Arduino / A Genuine"
C: \ Users \ lorenzo \ Desktop \ prog_esame ---- porta_rfid \ prog_esame ---- porta_rfid.ino: 1: 23: fatal error: RFID / RFID.h: No such file or directory #include <RFID / RFID. h> ^
compilation terminated.
exit status 1
Error compiling
Could you please help me ? thank you in advance. :slight_smile:

This is the sketch

 #include <Servo.h> 
#include <SPI.h>
#include <RFID.h>

Servo moto ;
/* Vengono definiti PIN del RFID reader*/
#define SDA_DIO 10  // 53 per Mega
#define RESET_DIO 9
#define delayRead 1000 // Time of delay 
#define delayLed 2000 
#define ledVerde 3
#define ledRosso 4
/* Viene creata una istanza della RFID libreria */
RFID RC522(SDA_DIO, RESET_DIO); 
long uno = 696; // rappresenta la somma delle 4 cifre 
int due = 450;
int codiciAutorizzati[] ={518,due}; // contiene i codici autorizzati
 
void setup()
{ 
  moto.attach(2);
  moto.write(90);
  Serial.begin(9600);
  /* Abilita SPI*/
  SPI.begin(); 
  /* Viene inizilizzato RFID reader */
  RC522.init();
  Serial.println(" mostrare il pass ");
  pinMode(ledVerde,OUTPUT);
  pinMode(ledRosso,OUTPUT);
}
 
void loop()
{
  /* Temporary loop counter */
  byte i;
  // Se viene letta una tessera
  if (RC522.isCard())
  {
    // Viene letto il suo codice 
    RC522.readCardSerial();
    int codiceLetto = 0;
    Serial.println("Codice pass:");
 
    // Viene caricato il codice della tessera, all'interno di una Stringa
    for(i = 0; i <= 4; i++)
    {
      codiceLetto+=RC522.serNum[i];
    }
    Serial.println(codiceLetto);
    if(verificaCodice(codiceLetto)){
      moto.write(-90);
      Serial.println("Pass autorizzato");
     digitalWrite (ledVerde,HIGH) ;
      delay(3000);
      moto.write(90);
      digitalWrite(ledVerde,LOW);
    }else{
      Serial.println("Pass non autorizzato");
      accendiLed(ledRosso);
    }
  delay(delayRead);  
  }
}
// Questa funzione verifica se il codice Letto è autorizzato
boolean verificaCodice(int codiceLetto){
  boolean autorizzato = false;
  for(int i = 0; i < sizeof(codiciAutorizzati) ; i++){
    if(codiceLetto==codiciAutorizzati[i]){
      autorizzato = true;
    }
  } 
  return autorizzato;
}    
// Questa funzione permette di accendere un LED per un determinato periodo
void accendiLed(int ledPin){
  digitalWrite(ledPin,HIGH);
  delay(delayLed);
  digitalWrite(ledPin,LOW);
}

Hey there, welcome to the community!
Thought I’d love to help, I think you’re in the wrong community. From your post, it seems as though you’re using an Arduino board, and not a Particle board (or Particle compound). This forum is focuses around those boards, and though they’re very similar, they have their fair share of differences as well. That’s all to say that it’s probably more likely to find more adequate help in an Arduino-dedicated forum, since that’s more their thing.
On the other hand, why not get a Particle device and use that instead of the Arduino you’re currently using? At a minimum it should be able to do all the same things, but it’s much more powerful, and the integrated connectivity options open up a whole new range of possibilities. Definitely worthwhile checking out!
Best of luck!

@lorard, just a shot in the dark but from the error it seems you did not add the RFID library folder/files to the arduino library directory. You may want to read this guide on how to do it:

https://www.arduino.cc/en/Guide/Libraries

:wink:

2 Likes