Hi
This is MFRC522 Library For Raspberry Pi On B4J ( RC522 Library From GPIO)
pi4j-core.jar library required
Enabling SPI Feature on GPIO Required
You Can Enable It From /boot/config.txt
Example For This Library
This is MFRC522 Library For Raspberry Pi On B4J ( RC522 Library From GPIO)
pi4j-core.jar library required
Enabling SPI Feature on GPIO Required
You Can Enable It From /boot/config.txt
Example For This Library
B4X:
Dim nfc As NFCRC522
Dim result As Int
nfc.Initialize
result = nfc.FindCard
If result == nfc.Mifare_OK Then
Dim bc As ByteConverter
Dim sector As Byte = bc.HexToBytes("DataToHex")
Dim block As Byte = bc.HexToBytes("00")
Dim keyA() As Byte = bc.HexToBytes("Key")
result = nfc.Auth_Card_With_KeyB(sector,block,keyA)
'Log("Auth as KeyA")
Dim keyB() As Byte = bc.HexToBytes("Key")
result = nfc.Auth_Card_With_KeyA(sector,block,keyA)
If result == nfc.Mifare_OK Then
Log("Authentication SuccessFull")
' Below method gives Data as Bytes
nfc.ReadToBytes(sector,block)
'or
'use below method to give as UTF8 String
nfc.ReadToString(sector,block)
Else
Log("Authentication Error")
End If
End If
nfc.Close
Attachments
Last edited: