I'm stuck with my project, i am trying to send data over WiFi shield from my RFID reader. Reader reads data in byte, and Wifi shield needs data to be in char type in order to send it. I will post only the code that is relevant to this issue, since the whole project is pretty big.
char packetBuffer[255];
byte readCard[4];
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return;
}
if ( ! mfrc522.PICC_ReadCardSerial()) {
return;
}
for (byte i = 0; i < mfrc522.uid.size; i++) { // for size of uid.size write uid.uidByte to readCard
readCard[i] = mfrc522.uid.uidByte[i];
Serial.print(readCard[i], DEC);
sprintf (packetBuffer, "%c", readCard);
Serial.print(packetBuffer);
Serial.print(readCard*, DEC); ---- gives me the right card number (1329319791) but when i convert data, the data is bad (1213*
).
I am aware that this could probably be done using strings, but i have just started using Arduino and C++ so i lack knowledge and experience. Any help would be much appreciated.