Esp8266 WiFi ERR_CONNECTION_REFUSED error

Hi Guys.
I Made an Esp8266 Access Point. When I connect to AP with laptop is work good. But if I would connect with android phone, the dhcp not get ip address for me. I tried with static Ip. So I can connect to wifi, but if I write in browser for example 192.168.1.1/speed , I get ERR_CONNECTION_REFUSED error. What's wrong?

#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include<SoftwareSerial.h> //Included SoftwareSerial Library
//Started SoftwareSerial at RX and TX pin of ESP8266/NodeMCU
SoftwareSerial s(3,1);
int data=5;
/* Put your SSID & Password */
const char* ssid = "AstraF";  // Enter SSID here
const char* password = "AstraF16";  //Enter Password here

/* Put IP Address details */
IPAddress local_ip(192,168,1,1);
IPAddress gateway(192,168,1,1);
IPAddress subnet(255,255,255,0);

ESP8266WebServer server(80);

uint8_t LED1pin = BUILTIN_LED;
bool LED1status = LOW;

uint8_t LED2pin = D6;
bool LED2status = LOW;

void setup() {
  s.begin(9600);
  pinMode(LED1pin, OUTPUT);
  pinMode(LED2pin, OUTPUT);
  //WiFi.softAP(ssid, password);
  WiFi.softAP(ssid, password);
  WiFi.softAPConfig(local_ip, gateway, subnet);
  delay(100);
  
  server.on("/speed", CarSpeed);
  server.on("/distanceinm", CarDistanceM);
  server.on("/distanceinkm", CarDistanceKM);
  server.on("/owner", CarOwner);
  server.onNotFound(handle_NotFound);
  
  server.begin();
}
void loop() {
  server.handleClient();
  if(data==2)
  digitalWrite(LED1pin,LOW);
  if(data==3)
  digitalWrite(LED1pin,HIGH);
  //s.write(data);
}

void CarSpeed()
{
  data=2;
  s.write(data);
  //digitalWrite(LED1pin.LOW);
}

void CarDistanceM()
{
  data=3;
  s.write(data);
  //digitalWrite(LED1pin,HIGH);
}

void CarDistanceKM()
{
  data=4;
  s.write(data);
}

void CarOwner()
{
  data=4;
  //s.write(4);
}

void handle_NotFound(){
  //server.send(404, "text/plain", "Not found");
}

https://github.com/esp8266/Arduino/issues/1956

WereCatf solved my problem. I change the ip to 192.168.1.100 in android and then all works perfectly.

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