A lock for many RFID cards

Hello,
I have a problem, this program does not work for me :slight_smile:
I’m too thin
I need you to work on several RFID cards.
Greetings and thank you for the hints.
The person who wrote this program is not very happy with Arduino, but only creates projects on the system by making tiles yourself.

#include <SPI.h>
#include <MFRC522.h>

//#define przekaznik 8
#define ilosc_brelokow 4

const byte UID[ilosc_brelokow][4] = {
 {0x00, 0x00, 0x00, 0x00},
 {0x11, 0x11, 0x11, 0x11},
 {0x22, 0x22, 0x22, 0x22},
 {0x33, 0x33, 0x33, 0x33},
};

const byte PRZEKAZNIKI[ilosc_brelokow] = {
 8,
 0,
 0,
 0
};

int stan = 0;
int poprzedni_stan = 0;

MFRC522 rfid(10, 9);
MFRC522::MIFARE_Key key;


void setup() {

 int i;
 
 Serial.begin(9600);
 SPI.begin();
 rfid.PCD_Init();

 for(i= 0; i < ilosc_brelokow; i++){
   pinMode(PRZEKAZNIKI[i], OUTPUT);
   digitalWrite(PRZEKAZNIKI[i], HIGH);
 }
 
}

void wlacz_przekaznik(int ktory)
{
 digitalWrite(PRZEKAZNIKI[ktory], LOW);
}

void wylacz_przekaznik(int ktory)
{
 digitalWrite(PRZEKAZNIKI[ktory], HIGH);
}

/
*
* The function compares the current reading from the sensor with the global table with UID
* If any of the entries from the table matches, returns its index
* If none of the entries match, returns -1
*/

int checkUid(void){

 int i;
 
 for(i= 0; i < ilosc_brelokow; i++){
   if( rfid.uid.uidByte[0] == UID[i][0] && rfid.uid.uidByte[1] == UID[i][1] && rfid.uid.uidByte[2] == UID[i][2] && rfid.uid.uidByte[3] == UID[i][3] )
     return i;
 }

 return -1;
}

void loop() {

 int karta;
 
 if (rfid.PICC_IsNewCardPresent() && rfid.PICC_ReadCardSerial())
 {
   karta= checkUid();
   
   if ( karta >= 0)
   {
     if (digitalRead(PRZEKAZNIKI[karta]) == HIGH)
     {
       Serial.println("GOOD: LIGHT ON");
       Serial.println("");
       digitalWrite(PRZEKAZNIKI[karta], LOW);
       poprzedni_stan = 1;
       stan = 1;
     }
     else
     {
         Serial.println("GOOD: LIGHT OFF");
         Serial.println("");
         digitalWrite(PRZEKAZNIKI[karta], LOW);
         poprzedni_stan = 0;
         stan = 0;
     }



   } else
   {
     Serial.println("BAD");
   }
   rfid.PICC_HaltA();
   rfid.PCD_StopCrypto1();
 }


}