RFID rc522 modul

Help i tried using the rfid modul but i cant get it working i tried 4 codes and nothing is working
it also could be my Module, pls help!

here is my code: (some things are in german ignore them its the help thingis, to better understand the code)

// RFID-Bibiothek hinzufügen

#include "MFRC522.h"

// Anschlüsse definieren

#define SDA 10

#define RST 9

// LEDs

#define grueneLED 6

#define gelbeLED 7

// Zustand der LEDs false = beim Start ausgeschaltet

bool StatusgelbeLED = false;

bool StatusgrueneLED = false;

// RFID-Empfänger benennen, Pins zuordnen

MFRC522 mfrc522(SDA, RST);

void setup()

{

  Serial.begin(9600);

  SPI.begin();

  // Initialisierung des RFID-Empfängers

  mfrc522.PCD_Init();

  pinMode(gelbeLED, OUTPUT);

  pinMode(grueneLED, OUTPUT);

}

void loop()

{

  String WertDEZ;

  // Wenn keine Karte in Reichweite ist ..

  if (!mfrc522.PICC_IsNewCardPresent())

  {

    // .. wird die Abfrage wiederholt.

    return;

  }

  // Wenn kein RFID-Sender ausgewählt wurde ..

  if (!mfrc522.PICC_ReadCardSerial())

  {

    // .. wird die Abfrage wiederholt.

    return;

  }

  Serial.println("Karte entdeckt!");

  // Dezimal-Wert in Strings schreiben

  for (byte i = 0; i < mfrc522.uid.size; i++)

  {

    WertDEZ = WertDEZ + String(mfrc522.uid.uidByte[i], DEC) + " ";

  }

  // trim() -> Leerzeichen am Ende des Strings entfernen

  WertDEZ.trim();

  // Kennung dezimal anzeigen

  Serial.println("Dezimalwert: " + WertDEZ);

  // gelbe LED schalten

  if (WertDEZ == "67 217 130 21")

  {

    // Status ändern an/aus

    StatusgelbeLED = !StatusgelbeLED;

    digitalWrite(gelbeLED, StatusgelbeLED);

  }

  // grüne LED schalten

  if (WertDEZ == "3 208 23 23")

  {

    // Status ändern

    StatusgrueneLED = !StatusgrueneLED;

    digitalWrite(grueneLED, StatusgrueneLED);

  }

  // Wartezeit verhindert, dass die Karte nur einmal erkannt wird

  delay(1000);

}

Welcome to the forum

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

Please post your full sketch, using code tags when you do

Posting your code using code tags prevents parts of it being interpreted as HTML coding and makes it easier to copy for examination

In my experience the easiest way to tidy up the code and add the code tags is as follows

Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

Please properly edit your code to be inside a code block.

Can you additionally show a schematic diagram of you wired everything up? Or a photo of it?

Have you tried known good firmwares like

https://github.com/miguelbalboa/rfid/blob/master/examples/firmware_check/firmware_check.ino

to see if your module is being detected at all?

i dont have the programm to do a diagram i am new

You can equally describe it in plain text what your pin connections are.

Draw the circuit diagram using pencil and paper. Label all devices and the pins that you use. Take a photograph of the circuit and paste it into a reply here

To post images etc. you need trust level 1, you can get there by:

  • Entering at least 5 topics
  • Reading at least 30 posts
  • Spend a total of 10 minutes reading posts

Users at trust level 1 can...

  • Use all core Discourse functions; all new user restrictions are removed
  • Send PMs
  • Upload images and attachments

i tried it and semms like it is broken i can reclaim it if that is the right word for that, anyways thank you for your fast help.

Not everything requires a program to do. Schematics drawn on paper with pen or pencil and then photographed have been done for decades.