Hi everyone , I am new to coding and i am trying to make a Rfid door lock system using arduion . But i can’t understand the following line of code can anyone help me understand it:----
for (byte i = 0; i < mfrc522.uid.size; i++)
{
Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " “);
Serial.print(mfrc522.uid.uidByte[i], HEX);
content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0” : " "));
content.concat(String(mfrc522.uid.uidByte[i], HEX));
}
This is just wrapping the data stored in a character array mfrc522.uid.uidByte[]
into human readable form (HEX notation e.g. 01 23 45 67 89 AB CD EF
)
for (byte i = 0; i < mfrc522.uid.size; i++) // do the whole lot <size> times
{ // first print data to USB serial port
Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "); // numer to print is only one digit prepend blank AND 0 otherwis only blank
Serial.print(mfrc522.uid.uidByte[i], HEX); // print the number in hexadecimal notation
// then do the same for a String <content> variable adding (concatenating) one number at a time
content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
content.concat(String(mfrc522.uid.uidByte[i], HEX));
}
1 Like
Thank you so much sir …
hi, I have problem with this code.
Iam using mega arduino. please help me.
error : expected primary-expression before ‘.’ token
@matin123, this forum is for Particle devices, not Arduino. You may want to post in the Arduino forum.
2 Likes