This library provides a Microsoft Makecode package for the Joy-IT SBC-RFID-RC522 RFID module. See https://joy-it.net/products/SBC-RFID-RC522 for more details.
The RFID module needs to be connected with six pins to the Micro:bit:
RFID module | Micro:bit |
---|---|
VCC | 3V |
GND | GND |
MISO | P15 |
MOSI | P14 |
SCK | P13 |
NSS | P16 |
The RFID module needs to be initialized before it is ready to use. All necessary commands will be transfered via SPI here.
// Initialize RIFD module
MFRC522.Init()
This function reads the cards unique ID and returns it.
// Read unique ID
MFRC522.getID()
Data stored on the card can be retrieved with this function.
// Read data
MFRC522.read()
Write data, formatted as string, to the card.
// Write data
MFRC522.write("1234")
After use, the antenn can be turned off.
// Turn antenna off
MFRC522.AntennaOff()
MIT