Hi everyone,
I've been playing around with the TextFinder library and seem to have hit a wall. The project is supposed to pull text from an rss feed and if it sees one of the keywords, it makes a servo move. The problem I encounter occurs only when a keyphrase that is not yet present is before one that is already in the feed. This results in TextFinder telling me that none of my keyphrases are present even if they are.
if (client.connected()) {
for (int i = 0; i < 4; i++) { // for loop iterates through keyphrase array
Serial.println("for loop"); // making sure the loop iterates from 0-3, which it does
Serial.println(i);
if (finders[i].find(myPhrases[i]) ) { // text finder for parsing xml data for keyphrases
Serial.print("Phrase ");
Serial.print(myPhrases[i]); //making sure the phrases iterate, which they do
Serial.println(" has been found");
myPhrases[i] = 0; // nulls the array entry
servos[i].write(0); // moves the servo to desired position
servos[i].detach(); // detaches the servo from the pin
}
else {
Serial.println(i);
Serial.println(myPhrases[i]); //another check to make sure the phrases iterate, which they do
Serial.println("no phrase found");
}
delay(1000);
}
Serial.println("Disconnected");
}
client.stop();
client.flush();
delay(3000); // wait 3 seconds before next update
}
The code above shows my attempt at creating four different finder instances and iterating through them as well but to no avail. Even when the first phrase is present, TextFinder only seems to recognize one correct phrase per for loop, meaning that if the first and last phrases (0 and 3) are present, I receive 16 iterations instead of both of them just being recognized in the first loop. Anyone have any idea what I'm doing wrong?