Hello, I am writing some code that will function as a RFID door system. At the beginning of the program, I want to define the list/array/vector and give it 6 strings. These strings are the codes of the acceptable ID's that will allow the door to be unlocked. So in the program it scans the list, and also can add a new string to the list if a new ID card wants to be added.
I have had trouble using arrays, and I know that vectors can be much easier. However, I've found that arduino doesn't support vectors? Anyone have any experience with vectors? Or using a list of strings in the past?
Sometimes I get my languages mixed up.
Thanks for pointing it out my mistake. I've edited my reply.
Regardless, vectors are growing structures and unnecessary here. Either a fixed number of slots or a 2d array (because the keys should be uniform size) are best here.
Assuming the RFID identifier are a known length, let's say 12 characters, you would set aside as many entries as the most you need and use a 2D array:
// Make room for 20 ID's of 12 characters each:
char ValidIDs[20][13] =
// Initialize the first six
{
"ID One",
"ID Two",
"ID Three",
"ID Four",
"ID Five",
"ID Six"
};
// The remaining 14 will be all zeroes. If the first byte of an entry is zero, the entry is available.