Create an array of char an put it:
char theCode[5];
if (bytesread == 12) {
for (i=0; i<5; i++) {
if (code[i] < 16) Serial.print("0");
// Serial.print(code[i], HEX);
theCode[i] = code[i];
}
Serial.println(theCode);
}
Frage
I want to store the same that is displayed in the Serial Monitor in a variable, because after that i can send the value to a Database. That's the code:
if (bytesread == 12) {
for (i=0; i<5; i++) {
if (code[i] < 16) Serial.print("0");
Serial.print(code[i], HEX);
}
Serial.println();
}
Is Displayed at Serial Monitor the tag that i scan:
04007E4985
I want to store the tag value in a variable like:
tag = code[i];
Some sugestion?
Lösung
Create an array of char an put it:
char theCode[5];
if (bytesread == 12) {
for (i=0; i<5; i++) {
if (code[i] < 16) Serial.print("0");
// Serial.print(code[i], HEX);
theCode[i] = code[i];
}
Serial.println(theCode);
}