Using TextFinder to scan text input multiple times


I have an arduino Fio sending data via an Xbee to an Uno board. There are multiple different data points being sent from the Fio to the Uno and each has a 2 letter prefix to identify what it represents. I am trying to use the TextFinder library to pull the data and store it into the proper variables. I am able to collect the integer value from the first call to finder but once I add a second one (I need at least 6) the program no longer outputs anything. Here is the code that I am using:

#include <Wire.h>
#include <TextFinder.h>

int AX;
int X;
float XG;
int AY;
int Y;
float YG;

TextFinder finder(Serial); //Should be changed to the xbee soft serial port

void setup()
  //Add soft serial declerations here
void loop()
  AX = finder.getValue();
  AY = finder.getValue();
  XG = AX * 10;
  YG = AY * 5;

Thank you very much.



boolean find(char *target);

This reads from the stream until the given target is found. It returns true if the target string is found. A return of false means the data has not been found anywhere in the stream and that there is no more data available. Note that TextFinder takes a single pass through the stream, there is no way to go back to try and find or get something else (see the findUntil method ).

Yes, I'm aware that it is only designed to go through once. I was wondering how I would go about searching through the same string multiple times? Not necessarily using that library. Thank you.


how I would go about searching through the same string multiple times?

If you can capture the string, then you probably can use the string functions.

I did a port of a regular expression parser:

It may be overkill for what you want, but it is non-destructive. You would, of course, need to buffer up the string first.