Go Down

Topic: String Library Bugs? Substring and Index Of.. (Read 489 times) previous topic - next topic

rafaelgimenes

I've include in my librarys WString 0.8;
And i tryng get a data from browser using method get, to filter and print in lcd.
But the function substring not working...

Code: [Select]

if (c == '\n') {
       
         lcd.clear();
       lcd.print("lendo cmd" + linhaEntrada.length()) ;
         lcd.setCursor(0,1);
         lcd.print(linhaEntrada) ;
         //Analise aqui o conteudo enviado pelo submit
         if(linhaEntrada.contains("GET")){
           // se a linha recebida contem GET e R1=ON etnão ativa o pino do rele
           if(linhaEntrada.contains("R1=ON")){
             digitalWrite(pinDigRele,HIGH) ;
             releAtivado=true ;
               lcd.setCursor(0,1);
               lcd.print("rele ativado");
             delay(100);
               enviaEmail(0);
           }

// its not working... indexOf and substring
            if(linhaEntrada.contains("L1=")){
             Serial.begin(9600);
             int textoini = linhaEntrada.indexOf("=");
             txtWebLcd = linhaEntrada.substring(textoini+1,textoini+16); //expample
             Serial.println(txtWebLcd); //nothing showed
             Serial.println(textoini); /nothing showed
             Serial.println(linhaEntrada.substring(1,2)); //using directly /nothing showed  
             Serial.println(linhaEntrada.length());
             lcd.clear();
             lcd.print("conteudo L1");
             lcd.setCursor(0,1);
             lcd.print(linhaEntrada.substring(3,10));
             delay(3000);
           }


Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy