I have an arduino sketch, that listens for RFID tags, and gets their uid's and stores them in an array of uint32_t
This is an arduino_uno project with an adaFruit BTLE and as adafruit NFC/RFID Shield
The array is initiated like so:
uint32_t items[]= { 0,0,0,0,0,0};
Then in my loop();
I find an id like so:
success = nfc1.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);
//
Serial.println(success,DEC);
if (success) {
// Display some basic information about the card
//Serial.println("Found an ISO14443A card");
//Serial.print(" UID Length: ");Serial.print(uidLength, DEC);Serial.println(" bytes");
//Serial.print(" UID Value: ");
nfc1.PrintHex(uid, uidLength);
if (uidLength == 4)
{
// We probably have a Mifare Classic card ...
cardid = uid[0];
cardid <<= 8;
cardid |= uid[1];
cardid <<= 8;
cardid |= uid[2];
cardid <<= 8;
cardid |= uid[3];
Serial.print("Seems to be a Mifare Classic card #");
Serial.println(cardid);
BTLEserial.print(cardid);
}
Serial.println("");
}
Not that that block of code prints out to the Serial Monitor this:
Seems to be a Mifare Classic card #347161076
Writing out to BTLE: 0x31 0x36 0x38 0x38 0x34
But the BTLE app is seeing
16884
" as the cardid?
It seems obvious that this is do to some weird byte conversion on the uint32_tbeing handled by the BTLEserial.print()
method.
As i find id's I am storeing up to six of them in the items array above. I would like to send that entire array via blue tooth to my device, as a comma separated string.
Please help convert this uint32_t to either a string or other object that can be handled by the BTLE