Only having an issue wiht the image. I just get a blue square. Is that correct?
And one question: How to genereate the code for an image?
Explore... Chat... Share...
Moderator: igrr
taoyanren wrote:on WIFI_AP_STA mode, I can only access the station ip webserver but can not open AP ip webserver( http://192.168.4.1/) at the same time. Why?
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
String form = "<form action='led'><input type='radio' name='state' value='1' checked>On<input type='radio' name='state' value='0'>Off<input type='submit' value='Submit'></form>";
ESP8266WebServer server(80);
const int led = 13;
void handle_led() {
int state = server.arg("state").toInt();
digitalWrite(led, state);
server.send(200, "text/plain", String("LED is now ") + ((state)?"on":"off"));
}
void setup(void) {
Serial.begin(115200);
Serial.println("");
pinMode(led, OUTPUT);
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
WiFi.softAP("ESP_WiFiSwitch");
Serial.println(WiFi.softAPIP());
server.on("/", [](){
server.send(200, "text/html", form);
});
server.on("/led", handle_led);
server.begin();
Serial.println("HTTP server started");
}
void loop(void) {
server.handleClient();
}
In the "Good old days" one could achieve[…]
This guide shows how to wire an OLED display with […]
Hi there! Welcome to the site! I understand that y[…]
Firmware may be worn out due to prolonged use. I[…]
In this article, you'll learn how to use the Ardui[…]
This tutorial shows how to create a web server tha[…]
220 x 220 / 8 is just over 6k bytes Hehehe, that[…]
Yes, you will have to specify the content-type for[…]
Hello, I am answering this question to help solve […]
Follow US on Twitter and get ESP8266 news and updates first.