payloadAsString doesn't work as expected?
Opened this issue · 2 comments
Hi. I used this example
https://github.com/don/NDEF/blob/master/examples/ReadTagExtended/ReadTagExtended.ino
to read a RFID-Tag and compare the written text with a given string. It doesn't work as expected and as far as I can tell it's because of a 0x00 that is saved with the string.
I tried this:
if (payloadAsString == Hammer) {Serial.println(" The object is a Hammer"); }
... but it fails.
This snippet seems to be the problem:
String payloadAsString = ""; for (int c = 0; c < payloadLength; c++) { payloadAsString += (char)payload[c]; }
Any hints what to change?
a possible workaround:
String payloadAsString = ""; for (int c = 1; c < payloadLength; c++) { payloadAsString += (char)payload[c]; }
by using c=1
the initial 0x00
won't be read!