Environment
arduino uno
esp-01s
#include<ESP8266WiFi.h>
#include<ESP8266WebServer.h>
#include<WiFiClient.h>
#include <ESP8266mDNS.h>
const char *ssid="test01"; //SSID
const char *pass="12345"; //パスワード
const IPAddress ip(192,168,4,2); //サーバーのIPアドレス
const IPAddress subnet(255,255,255,0); //サブネットマスク
ESP8266WebServer server(80);
void setup()
{
Serial.begin(115200);
WiFi.softAP(ssid,pass); //SSIDとパスの設定
delay(100); //接続失敗防止
WiFi.softAPConfig(ip,ip,subnet); //IPアドレス、ゲートウェイ、サブネットマスクの設定
IPAddress myIP = WiFi.softAPIP(); //WiFi.softAPIP()でWiFi起動
server.begin(); //サーバーを起動(htmlを表示させるため)
Serial.println();
/*各種情報を表示*/
Serial.println("WiFi connected");
Serial.print("SSID:");
Serial.println(ssid);
Serial.print("AP IP address:");
Serial.println(myIP);
Serial.println("Server start!");
}
size_t value;
void loop()
{
//接続したクライアントの情報を得る。
WiFiClient client = server.available();
if(client){
Serial.println("new client");
while(client.connected()){
if(client.available()){
value=client.read();
Serial.println(value);
delay(1000);
}
}
}
}
Arduino:1.8.19 (Windows Store 1.8.57.0) (Windows 10), ボード:"Generic ESP8266 Module, 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, dtr (aka nodemcu), 26 MHz, 40MHz, DOUT (compatible), 2MB (FS:1MB OTA:~512KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory, Disabled, HTTP_CLIENT, Only Sketch, 115200"
C:\Users\sora3\Documents\Arduino\sketch\WiFiServer\WiFiServer.ino: In function 'void loop()':
WiFiServer:36:30: error: 'using ESP8266WebServer = class esp8266webserver::ESP8266WebServerTemplate<WiFiServer>' {aka 'class esp8266webserver::ESP8266WebServerTemplate<WiFiServer>'} has no member named 'available'
36 | WiFiClient client = server.available();
| ^~~~~~~~~
exit status 1
'using ESP8266WebServer = class esp8266webserver::ESP8266WebServerTemplate<WiFiServer>' {aka 'class esp8266webserver::ESP8266WebServerTemplate<WiFiServer>'} has no member named 'available