Sub rfid_CardPresent (UID() As Byte, CardType As Byte)
Log("UID: ", bc.HexFromBytes(UID))
Log("Type: ", CardType, ", Is it Mifare: ", rfid.IsMifare)
If rfid.IsMifare Then
Dim authenticate_key() As Byte = Array As Byte(0x8D,0x6E,0x14,0xB5,0xEC,0xA6)
If rfid.MifareAuthenticate2(1,authenticate_key,True) = False Then
Log("Failed to authenticate")
Return
End If
Dim buffer(18) As Byte
If rfid.MifareRead(1, buffer) > 0 Then 'buffer size must be 18 bytes or more
Log(bc.HexFromBytes(buffer))
Else
Log("Failed to read")
End If
If rfid.MifareAuthenticate2(2,authenticate_key,True) = False Then
Log("Failed to authenticate")
Return
End If
If rfid.MifareRead(8, buffer) > 0 Then 'buffer size must be 18 bytes or more
Log(bc.HexFromBytes(buffer))
Else
Log("Failed to read")
End If
End If
End Sub