RFID check

Ok, i placed...on the top of loop

If you think the device is so stupid that it needs to be told over and over what to do, perhaps you should just send it back, and get a different reader.

If not, put that code back in setup where it belongs.

  if(RFID.available()>0){
    
  val = RFID.read();
  Serial.println();
  while (val != 0xAB){  
    val = RFID.read();
    delay(10);
      
  }

So, now the spin waiting for a start marker will only happen if there is something to read. Great.

But, if there is nothing to read,

  RFID.read();
  RFID.read();
  data[0] = RFID.read();    
  data[1] = RFID.read();   
  data[2] = RFID.read();    
  data[3] = RFID.read();

read 6 bytes anyway.

Go back and re-read my previous reply.

You should only do something in loop IF there if RFID says that there is data to read.