I'm trying to setup an access point with my ESP8266 to broadcast internet with the following code:
#include <ESP8266WiFi.h>
WiFiServer server(80);
const char *ap_ssid = "SAP";
const char *ap_password = "11112222";
const char *sta_ssid = "SSIDwithinternet";
const char *sta_password = "SSIDwithinternetPASS";
void setup() {
Serial.begin(115200);
Serial.println();
WiFi.mode(WIFI_AP_STA);
Serial.println("******************************");
Serial.print("Connecting to ");
Serial.println(sta_ssid);
WiFi.begin(sta_ssid, sta_password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
Serial.println("Configuring access point...");
WiFi.softAP(ap_ssid, ap_password);
IPAddress myIP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(myIP);
}
void loop() {
}
However, when I connect to the access point with my phone or laptop, there is no internet. Am I missing something here?
The monitor shows the following:
Configuring access point...
AP IP address: 192.168.4.1
******************************
Connecting to Connect4G
....
WiFi connected
IP address:
192.168.100.104