1

how are you?. I'm using an ESP-01 with platformIO wich is programmed using esptool.py to run an example of a web server that I found in a book called "NodeMCU ESP8266 Communication Methods and Protocols: programming with arduino IDE". The code is the following:

#include <Arduino.h>
#include <ESP8266WebServer.h>
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>

const char *wifiName = "XXX";
const char *wifiPassword = "YYYY";

ESP8266WebServer server(80);

int ledPin = 1;

void handleRoot()
{
    //digitalWrite(ledPin,LOW);
    server.send(200,"text/plain","hello from esp8266");
    delay(1000);
    //digitalWrite(ledPin,HIGH);
}

void setup() {
// put your setup code here, to run once:
    Serial.begin(115200);
    delay(5000);
    //pinMode(ledPin,OUTPUT);
    Serial.print("Conectando");
    WiFi.begin(wifiName,wifiPassword);
    while (WiFi.status() != WL_CONNECTED)
    {
    /* code */
        delay(500);
        Serial.print(".");
    }
    Serial.println("");
    Serial.println("Conectado por WIFI");
    Serial.println("Dirección IP: ");
    Serial.println(WiFi.localIP());
    server.on("/", handleRoot);
    server.begin();
    Serial.println("Servidor HTTP iniciado");
}

void loop() {
// put your main code here, to run repeatedly:
   server.handleClient();
}

the problem that I have here is that if the wifi connections is initiated then the board doesn't send any data over serial but if the wifi connection is not initiated then the data is sent normally. As you noted I've commented the writing to the "ledPin" since it is the same pin where is TX but even by doing that the ESP-01 doesn't send the data over serial with wifi enabled.

I think the wifi is somehow disabling the serial port but I don't know for sure.

Can anyone help me with this?.

Thanks in advance for the help.

4
  • NOTE: in any case the wifi connection and web server works, the only failure that I see is that the data isn't sent over serial. – vram Mar 6 at 16:59
  • 2
    does if print the IP address and "Servidor HTTP iniciado"? after that there is no print to Serial – Juraj Mar 6 at 17:02
  • I doesn't prin anything if the wifi is initiated, on the contrary, if I comment of everything related to the wifi or the server then it prints over serial, I don't know why – vram Mar 6 at 21:15
  • not even "Conectando" and dots? – Juraj Mar 7 at 8:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.