Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By rvinaso
#93309 Hi my friends! Greetings from Cuba. I am trying to use this library <List.hpp> that I found in the library administrator. However, when I try to access to the data that I add to the list, it returns empty. I think that the problem is in the use of pointers, I am not good on it, so please my friends, give me a hand. Thanks!!
This is the code


#include <List.hpp>


void setup() {
Serial.begin(115200);

List <String> list;


String test = " ";
String test1= "item";

for (int i = 0; i <= 5; i++)
{test= test1+i;
String testCopy;
testCopy(test);
list.add(testCopy);
Serial.println(*list[i]);
}

for (int i = 0; i <= 5; i++)
{Serial.print(i);

Serial.println(": ");
if(*list[i]=="item3")
{Serial.println("diferent"); //
}
Serial.println(*list[i]);
Serial.print("Capacity: ");
Serial.println(list.getSize());

}


}

void loop() {

}
User avatar
By rvinaso
#93344 sorry!! it was a mistake! you are right, he is the compiled code



#include <List.hpp>


void setup() {
Serial.begin(115200);



List <String> list;






String test = " ";
String test1= "item";

for (int i = 0; i <= 5; i++)
{test= test1+i;
String testCopy(test);
list.add(testCopy);
Serial.println(*list[i]);
}

for (int i = 0; i <= 5; i++)
{Serial.print(i);

Serial.println(": ");
if(*list[i]=="item3")
{Serial.println("here it is");
}
Serial.println(*list[i]);
Serial.print("Capacity: ");
Serial.println(list.getSize());

}


}

void loop() {

}