I have 5 RFID tags (in the final version there will be up to 50 RFID tags). Each of these TAGS reports multiple times. i need an output after scanning, each found TAG once.
Possibly the best solution to uniquely identify each TAG. Create a 2 dimensional array. The first dimension will be a counter, the second dimension will be the (for now) EPC (later TID & EPC). A loop checks whether the TAG is already contained in the array, if not it is added.
The Arduino uno has only 2KB SDRAM. What is the most effective way to create the 2 dimensional array, wich requires the least memory?
I use code form Example 1 - Constant Read
//Print EPC bytes, this is a subsection of bytes from the response/msg array
Serial.print(F(" epc["));
for (byte x = 0 ; x < tagEPCBytes ; x++)
{
if (nano.msg[31 + x] < 0x10) Serial.print(F("0")); //Pretty print
Serial.print(nano.msg[31 + x], HEX);
Serial.print(F(" "));
}
Serial.print(F("]"));
This gives me following Serial monitor output
epc[E2 00 00 17 22 0A 00 51 14 70 7F BD]
epc[E2 00 00 17 22 0A 00 38 14 70 7F 97]
epc[E2 00 00 17 22 0A 00 71 14 70 7F DF]
epc[E2 00 00 17 22 0A 00 38 14 70 7F 97]
epc[E2 00 00 17 22 0A 00 37 14 70 7F 9E]
epc[E2 00 00 17 22 0A 00 71 14 70 7F DF]
epc[E2 00 00 17 22 0A 00 71 14 70 7F DF]
As far as I can see, nano.msg is an array. But what type is the array? If I create the following array
byte tagEPCBytes[5][12];
I get the following error
error: invalid types 'byte {aka unsigned char}[int]' for array subscript
tagEPCBytes[counter][x] = nano.msg[31 + x];
I try to save the data from tagEPCBytes[counter] = nano.msg[31 + x];
for (byte x = 0 ; x < tagEPCBytes ; x++)
{
tagEPCBytes[counter][x] = nano.msg[31 + x];
Serial.print(nano.msg[31 + x]);
Serial.print(F(" "));
}
Serial.print(F("]"))
I need help with following questions
-
is a 2 dimensional array the best way to get each Tag once after a loop check?
-
What is the most effective way to create the 2 dimensional array, wich type requires the least memory?
-
Is nano.msg an array? When yes, what type is the array?
-
Why i get the error: invalid types ‘byte {aka unsigned char}[int]’ for array subscript?