Go Down

Topic: Can't connect to my wifi router (Read 225 times) previous topic - next topic

Henrik_t7

Hi
I have put an external antenna on my Wemos d1 Mini pro and broken this code but it does not work.

Same code works fine on my Wemos d1 Mini, what's wrong ??


Code: [Select]

/
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
 
#include "index.h" //Our HTML webpage contents
 
//SSID and Password of your WiFi router
const char* ssid = "lillenet 2.4 GHz";
const char* password = "xtqzzhenrikmie";
 
ESP8266WebServer server(80); //Server on port 80
 
//===============================================================
// This routine is executed when you open its IP in browser
//===============================================================
void handleRoot() {
 
 server.send(200, "text/html", MAIN_page); //Send web page
}
//==============================================================
//                  SETUP
//==============================================================
void setup(void){
  Serial.begin(9600);
 
  WiFi.begin(ssid, password);     //Connect to your WiFi router
  Serial.println("");
 
  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
 
  //If connection successful show IP address in serial monitor
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());  //IP address assigned to your ESP
 
  server.on("/", handleRoot);      //Which routine to handle at root location
 
  server.begin();                  //Start server
  Serial.println("HTTP server started");
}
//==============================================================
//                     LOOP
//==============================================================
void loop(void){
  server.handleClient();          //Handle client requests
}



martinius96

Code looks good.
Are you sure your router is not 5GHz?
Also is your router in reach of Wemos?
Arduino and website programmer

Henrik_t7

Hi
Thanks for the answer. My router is both a 2.4 Ghz and a 5 Ghz router.
My laptop is about 3 meters from my router and it runs on my 2.4 Ghz network and my wemos d1 my pro is right next to my laptop. My wemos is also with an exter antenna and not the one on the print
thanks

countrypaul

Does your router use the same SSID for both 2.4 & 5 GHz?
I have experienced problems with that sort of setup and turning off the 5GHz allowed things to work.

No idea if that will be your case but might just be worth checking.

Henrik_t7

Hi
No it uses two different names for ssid and two different codes.
My wemos d1 mini can easily find the 2.4 Ghz network and when you replace it with a wemos d1 mini pro with a long antenna it does not work. Same code but different wemos.

Maybe my china wemos d1 my pro is not working anymore.

Go Up