Esp01 does not connect to wifi repeater

I've made a simple code for the esp8266 where i can control an LED wirelessly via wifi.

down below is the code i am using.

#include<ESP8266WiFi.h>

const byte ledPin = 2;
const char *ssid = "ZenWifi";
const char *pass = "-------";

WiFiServer server (80);

void setup() {

  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, LOW);
  Serial.begin(115200);
  Serial.println("connecting to ");   Serial.println(ssid);

  WiFi.begin(ssid, pass);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.write('.');
  }
  Serial.println();

  Serial.println("connected to the wireless network !");

  digitalWrite(ledPin, HIGH);

  server.begin();

  Serial.println("Use this to connect");
  Serial.print("http://");
  Serial.print(WiFi.localIP());
  Serial.println("/");
}

void loop() {
  WiFiClient client = server.available();

  if (!client) return;

  Serial.println("handling new client");

  String request = client.readStringUntil('\r');
  while (client.available()) client.read();

  if (request.indexOf("/ON") != -1) {
    Serial.println("led on");
    digitalWrite(ledPin, HIGH);
  } else if (request.indexOf("/OFF") != -1) {
    Serial.println("led off");
    digitalWrite(ledPin, LOW);
  } else Serial.println(request);

  client.println("HTTP/1.1 200 OK");
  client.println("Connection: close");
  client.println();
  delay(1);

  // close the connection:
  client.stop();
  Serial.println("client disconnected");
}

in this project I am using an esp01 module which i want to connect to a wifi repeater.

the following link is the wifi repeater i am using.
Amazon.com: Xiaomi Mi Wifi Extender Pro, DVB4235GL

the code uploads fine to the esp01 module but the esp01 doesn't connect to the wifi repeater.

However, when i change the code to connect to the central router instead of the wifi repeater it works.

I have double checked the ssid of the repeater several times and even the password too.

i hope someone can help me find the solution to this problem.

thank you in advance.

try to add

WiFi.persitent(false);
WiFi.disconnect();

before WiFi.begin

just tried it and it didnt fix the problem.

Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advice on) your project :wink: See About the Installation & Troubleshooting category.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.