Connect and fetch data every X minutes

Hi,

I used 2 modified examples to try to connect to my server every X minutes, fecth data from a file, parse the content of the file and .... the final purpose was to LIGHT a led according to the file contents.

I can't do that
:frowning:

On the attached file, there is a small portion of code that was supposed to get the data between "<" and ">"
So, I have a file on the server side called ardu.txt that just has one line with:

I would lime to have a rule to turn on a led (PIN 7) if the file content was OK and turn off if the file contect was different from OK.

loop_ok.pde (3.21 KB)

    char c = client.read();
    //Serial.print(c);
    readString = c;
    int d1 = readString.indexOf('<');
    int d2 = readString.indexOf('>');
    readString1 = (readString.substring(d1+1,d2));

If c is <, it can't also be >. If it is >, it can't also be >. So, there are 3 possibilities:

  1. d1 could be -1 because c is >.
  2. d2 could be -1 because c is <.
  3. d1 and d2 are both -1 because c is something other than < or >.

In any case, the inputs to String::substring() are always invalid.