Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Luiz Henrique
#54208
martinayotte wrote:It is not clear what was your previous setup ...
Was it an Arduino connected with an ESP using AT firmware ?
The ESP8266WiFi is for an ESP stand-alone (without any Arduino).


i using ESP8266 Library, like a AT firmware.

Man, i will kiss you in rl, rlly hahaha, the code above it's working in my project

Code: Select allteste
Connection with host OK!
teste
Connection with host OK!

Very thanks for help me!
User avatar
By Luiz Henrique
#54210 This code really works for me, BUT i need a other trouble.
I need to use a decision with a my response.

Code: Select all    wifi.send((const uint8_t*)ComandoGET, strlen(ComandoGET));

    uint32_t len = wifi.recv(buffer, sizeof(buffer), 10000);
    char *resposta = buffer;
    for (i = 0; i < len; i++)
    {
        if (strncmp(resposta++, "\r\n\r\n", 4) == 0) break;
    }
    resposta += 3;
    String tratado = resposta;
    if (tratado="OFF")
    {
      Serial.print("OFF");
    }
    else
    {
      Serial.print("ON");
    }
    tratado = "";


In my case, he always print "OFF". typing same ON or OFF. I need to clear the buffer or the cache always in end of loop? How i can do this?
User avatar
By martinayotte
#54248
Luiz Henrique wrote:This code really works for me, BUT i need a other trouble.
I need to use a decision with a my response.

Code: Select all    String tratado = resposta;
    if (tratado="OFF")


In my case, he always print "OFF". typing same ON or OFF. I need to clear the buffer or the cache always in end of loop? How i can do this?


I think you need to learn a bit more about C/C++ ... :ugeek:
The code " if (tratado="OFF") " totally doesn't do what you wish.
You may use double equals, but since maybe other characters can follow the OFF, such \r\n, the equal probably won't succeed either. You need to do " if (resposta.startWith("OFF")) " instead.