B4J Library MFRC522 Library For RaspberryPi

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

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

  • MFRC522.jar
    9.2 KB · Views: 449
  • MFRC522.xml
    4.4 KB · Views: 482
Last edited:

jcohedman

Member
Licensed User
Longtime User
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

I will Post Example in Future

Hi! I'm trying to use this, but don't work:
Logs:
Unable to determine hardware version. I see: Hardware : BCM2835
- expecting BCM2708 or BCM2709.
 

fgrdovic21

Member
Licensed User
Longtime User
Hi,

Is it possible to give us an example? Or maybe a code snippet. I've just started working with Pi.
 
Top