When I set the softAPConfig IP to 192.168.1.1, the HTTP client fails to connect. If I set it to anything else; i.e. 192.168.0.1, the HTTP client works fine. Here is the test code to recreate the problem:
/**
* BasicHTTPClient.ino
*
* Created on: 24.05.2015
*
*/
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <ESP8266HTTPClient.h>
#define USE_SERIAL Serial
ESP8266WiFiMulti WiFiMulti;
IPAddress apIP(192, 168, 1, 1);
IPAddress apGateway(192, 168, 1, 1);
IPAddress apSubmask(255, 255, 255, 0);
void setup() {
USE_SERIAL.begin(115200);
WiFi.mode(WIFI_AP_STA);
WiFi.softAPConfig(apIP, apGateway, apSubmask);
WiFi.softAP("ESP8266");
USE_SERIAL.println();
USE_SERIAL.println();
USE_SERIAL.println();
for(uint8_t t = 4; t > 0; t--) {
USE_SERIAL.printf("[SETUP] WAIT %d...\n", t);
USE_SERIAL.flush();
delay(1000);
}
WiFiMulti.addAP("[SSID]", "[PASS]");
}
void loop() {
// wait for WiFi connection
if((WiFiMulti.run() == WL_CONNECTED)) {
Serial.print("Local IP Address: "); Serial.println(WiFi.localIP());
Serial.print("SoftAP IP Address: "); Serial.println(WiFi.softAPIP());
HTTPClient http;
USE_SERIAL.print("[HTTP] begin...\n");
http.begin("www.google.com", 80, "/");
USE_SERIAL.print("[HTTP] GET...\n");
// start connection and send HTTP header
int httpCode = http.GET();
if(httpCode) {
// HTTP header has been send and Server response header has been handled
USE_SERIAL.printf("[HTTP] GET... code: %d\n", httpCode);
// file found at server
if(httpCode == 200) {
String payload = http.getString();
USE_SERIAL.println(payload);
}
} else {
USE_SERIAL.print("[HTTP] GET... failed, no connection or no HTTP server\n");
}
}
delay(5000);
}