I 'borrowed' a sketch from robohubs instructables page, some of which I have included here :
#include <Arduino_BuiltIn.h>
//more details on robohub instructables page//
#include <WiFi.h>
#include <WiFiClient.h>
#include <WebServer.h>
String command; //String to store app command state.
int speedCar = 800; // 400 - 1023.
int speed_Coeff = 3;
const char* ssid = "NodeMCU Car";
WebServer server(80);
void setup() {
Serial.begin(115200);
// Connecting WiFi
WiFi.mode(WIFI_AP);
WiFi.softAP(ssid);
IPAddress myIP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(myIP);
// Starting WEB-server
server.on ( "/", HTTP_handleRoot );
server.onNotFound ( HTTP_handleRoot );
server.begin();
}
void loop() {
server.handleClient();
command = server.arg("State");
if (command == "F") goAhead();
else if (command == "B") goBack();
else if (command == "S") stopRobot();
}
void HTTP_handleRoot(void) {
if( server.hasArg("State") ){
Serial.println(server.arg("State"));
}
server.send ( 200, "text/html", "" );
delay(1);
}
that runs a robot from wifi for a 8266. I altered it to run an ESP32 mainly from
//#include <ESP8266WiFi.h>
//#include <WiFiClient.h>
//#include <ESP8266WebServer.h>
to
#include <WiFi.h>
#include <WiFiClient.h>
#include <WebServer.h>
and it ran my robot from the wifi app NodeMCU.
last night I opened the sketch and did some more altering only to find when I compiled it I got
J:\My Drive\mecanum robot car\file_for_the_forum\file_for_the_forum.ino:7:10: fatal error: WebServer.h: No such file or directory
7 | #include <WebServer.h>
| ^~~~~~~~~~~~~
compilation terminated.
exit status 1
Compilation error: WebServer.h: No such file or directory
I can't find the file WebServer.h in my library, I am sure I haven't deleted any libraries or altered the location of any, (it seems to still accept WiFi.h and WiFiClient.h as if it sees them?)
I have tried to add various libraries for webserver from the library list but none of them include WebServer.h
Why has it worked on previous evenings and not now?
Would someone mind trying to explain what I am doing wrong and the possible location of a library that holds the file I need?
Thanks.