Electric Door Lock using HC-05 and RFID

Hey guys, I’ve been trying to figure out where the problem is in the following code, trying to correct it in order for the code to do what it is meant to do, which is opening an Electric Lock through RFID and HC-05.

MFRC522_wrking.ino (9.93 KB)

I've been trying to figure out where the problem is in the following code

If you want us to help, you need to tell us what the code actually does, and how that differs from what you want.

    pinMode(in1, OUTPUT);

Why would you name an output pin in1?

Well the code is to control a RFID (13,56Hz) which decides if a certain user has access or not and for that I have a SD shield; I also make use of a Relay (only using 1 channel); and also use a Bluetooth Module (HC-05).
And my problem here is: once I can't understand where the Stary 302 and 240 errors are (firstly I used an outdated version of Arduino, leading me ti install the most recent version on my personal computer and those stray errors started popping up, and beforehand I used another RFID library and not the MFRC522 and yes I did delete the rest that belonged to the other library) summing up: i got rid of the other RFID lib code and input the new one, while the other codes belong to the other components.
About naming in1 for an Output, I kinda re-used another code, making a few changes for my purposes

    // Halt PICC
    // Stop encryption on PCD
} // This is the end of loop
 * Helper routine to dump a byte array as hex values to Serial.
void dump_byte_array(byte *buffer, byte bufferSize) {
    for (byte i = 0; i < bufferSize; i++) {
        Serial.print(buffer[i] < 0x10 ? " 0" : " ");
        Serial.print(buffer[i], HEX);


This is the piss-poorly indented dump_byte_array() function.


    if (cartao != " "){
      int perfil = verificaSD(cartao);
      if (perfil == 1){
          digitalWrite(5, HIGH);
          digitalWrite(5, LOW);      
      } else {
       for(int i =0; i<5; i++){
          digitalWrite(3, HIGH);
          digitalWrite(3, LOW);   
       for(int i =1; i<5; i++){
          digitalWrite(4, HIGH);
          digitalWrite(4, LOW);   

This is just some random crap you stuck in the middle of the file. Why did you do that?

Put EVERY { on a line BY ITSELF.
Put EVERY } on a line BY ITSELF.
Use Tools + Auto Format to properly indent your code.

Get rid of the useless blank lines at the ends of blocks/functions.

You have some non-printing characters in your code. When you finally get rid of all the code that is not in a function, and try to properly indent the code, and fix the places where the code does not indent properly, you get only one “error” message:

Sketch uses 16852 bytes (58%) of program storage space. Maximum is 28672 bytes.
Global variables use 984 bytes (38%) of dynamic memory, leaving 1576 bytes for local variables. Maximum is 2560 bytes.