Textfinder library

I have used the example given in the textfinder library and changed it slightly but when ever I send a 1 it does not work ??

#include <TextFinder.h>

TextFinder  finder(Serial);  
const int NUMBER_OF_FIELDS = 3; // how many comma seperated fields we expect                                           
int values[NUMBER_OF_FIELDS];   // array holding values for all the fields

void setup() 
{ 
  Serial.begin(115200); // Initialize serial port to send and receive at 115200 baud

  // Set up pins
  pinMode(11, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(9, OUTPUT);
} 

void loop()
{
  if(Serial.available())
  {
    getData();
    
    int lights = values[2];
    
    if(lights == '1')
    {
      digitalWrite(9, HIGH);
    }
    else
    {
      digitalWrite(9, LOW);
    }
    
    analogWrite(11, values[0]);
    analogWrite(10, values[1]);
    
  }
}

  void getData()
  {
    if(Serial.available())
    {
      int fieldIndex = 0; // the current field being received
      finder.find("I");   
      while(fieldIndex < NUMBER_OF_FIELDS)
        values[fieldIndex++] = finder.getValue();
      //for(fieldIndex=0; fieldIndex < NUMBER_OF_FIELDS; fieldIndex++)
      //Serial.println(values[fieldIndex]);
    }
  }

When I send:

I 255,255,1 /n

It does not work.

Thanks for any help

I have used the example given in the textfinder library and changed it slightly but when ever I send a 1 it does not work ??

So, you commented out the code that actually prints the data obtained. Why was that?

Because I don't need it to print the data. I just need to use it

Because I don't need it to print the data. I just need to use it

Then, you don't have a problem?

Just tried sending

I 255,255,1 /n

with this code

#include <TextFinder.h>

TextFinder  finder(Serial);  
const int NUMBER_OF_FIELDS = 3; // how many comma seperated fields we expect                                           
int values[NUMBER_OF_FIELDS];   // array holding values for all the fields

void setup() 
{ 
  Serial.begin(115200); // Initialize serial port to send and receive at 115200 baud

  // Set up pins
  pinMode(11, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(9, OUTPUT);
} 

void loop()
{
  if(Serial.available())
  {
    getData();
    
    int lights = values[2];
    
    Serial.print(values[2]);
    
    if(lights > 0)
    {
      digitalWrite(9, HIGH);
    }
    else
    {
      digitalWrite(9, LOW);
    }
    
    analogWrite(11, values[0]);
    analogWrite(10, values[1]);
    
  }
}

  void getData()
  {
    if(Serial.available())
    {
      int fieldIndex = 0; // the current field being received
      finder.find("I");   
      while(fieldIndex < NUMBER_OF_FIELDS)
        values[fieldIndex++] = finder.getValue();
      //for(fieldIndex=0; fieldIndex < NUMBER_OF_FIELDS; fieldIndex++)
      //Serial.println(values[fieldIndex]);
    }
  }

But on the serial monitor it says 5 and not 1 ?

      //for(fieldIndex=0; fieldIndex < NUMBER_OF_FIELDS; fieldIndex++)
      //Serial.println(values[fieldIndex]);

What would these show, if they weren't commented out?

Also, try sending something like:
I 123, 456, 7

Perhaps a clue will present itself.

Thanks
I have now realised its my program I'm using to send the Arduino data that's wrong.

Thanks for the help

My program was sending a number with a decimal place and the textfinder library thought it was the end of the number.