Searching for words on serial without saving input data?


when reading serial input data large save, need search inside anyway , words .

right accumulate data , specific word. while reading, without saving data , improve 1 :

 
code: [select]
  boolean waitfor(char  *target, long timeout)
        {

                unsigned long tm=millis();
                  while( 1 )
                  {
                    if( millis() - tm >= timeout )
                      return 0;

                    char wificontent[50]={0};
                    int readwifiindex=0;

                    while( wifiserial.available()  )
                    { 

                        if(readwifiindex<50)
                        {                 
                             wificontent[readwifiindex]=(char)wifiserial.read();
                             readwifiindex++;
                             delay(1); 
                        }


                    }


                //**check of specific words
                    if( strstr(wificontent,target) )
                       return 1;


                  }

        }


update: have changed code search while read, , great .

quote
i have changed code search while read, , great .
i interested see how have done it.


Arduino Forum > Using Arduino > Programming Questions > Searching for words on serial without saving input data?


arduino

Comments