• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Problem with ESP8266 NodeMCU web server

Q&A Forum › Category: ESP8266 › Problem with ESP8266 NodeMCU web server
0 Vote Up Vote Down
Phaykeo Chanthalangsy asked 4 years ago

I have tried to create web server with esp8266. Below is my code to be uploaded into esp8266. After uploading the code, I press Reset button and get unwritten characters like r$$?? … with baud rate of 115200 in serial monitor. What is wrong with that?
#include <ESP8266WiFi.h>
/* Put your SSID & Password */
const char* ssid = “MyNodeMCU”; // Enter SSID here
const char* password = “12345678”; //Enter Password here
WiFiServer server(80);
String header;
// Auxiliar variables to store the current output state
String output5State = “off”;
String output4State = “off”;
// Assign output variables to GPIO pins
const int output5 = 5;
const int output4 = 4;
// Current time
unsigned long currentTime = millis();
// Previous time
unsigned long previousTime = 0;
// Define timeout time in milliseconds (example: 2000ms = 2s)
const long timeoutTime = 2000;
void setup() {
Serial.begin(115200);
// Initialize the output variables as outputs
pinMode(output5, OUTPUT);
pinMode(output4, OUTPUT);
// Set outputs to LOW
digitalWrite(output5, LOW);
digitalWrite(output4, LOW);
// Connect to Wi-Fi network with SSID and password
Serial.print(“Connecting to “);
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(“.”);
}
// Print local IP address and start web server
Serial.println(“”);
Serial.println(“WiFi connected.”);
Serial.println(“IP address: “);
Serial.println(WiFi.localIP());
server.begin();
}
void loop()
{
}

1 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi.
When the ESP8266 resets, it will print some garbage.
Then, it should try to connect to Wi-Fi. It will start printing dots (……) until it connects.
Then, it will print the IP address.
The code you pasted doesn’t do anything else besides that.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.