Compilation for UNO R4 WiFi fails: "WebServer.h: No such file or directory"

Continuing the discussion from [SOLVED] Where has WebServer.h gone?:

Using an UNO R4 WiFi. WebServer.h not found!!!

#include <WiFi.h>
#include <WiFiClient.h>
#include <WebServer.h>

Compile error:

HTML2.ino.ino:5:10: fatal error: WebServer.h: No such file or directory
#include <WebServer.h>
^~~~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: WebServer.h: No such file or directory

What library is WebServer.h in?

I don't think it uses it..
Did you see the examples for the UNO R4 Wifi??
WiFi Webserver Example

good luck.. ~q

Thank you for the response.

Trying to read the response from a web form on my phone. Simplest case is two buttons. I want to be able to read the response to determine which button was pushed. Later I will add a text box to the form so I can retrieve a string of characters typed by the user to display on the R4's LED matrix.

Example from ChatGTP:

#include <WiFi.h>
#include <WiFiClient.h>
#include <WebServer.h>
#
const char* ssid = "xxxxxxxx";
const char *password = "yyyyyyyy";

WebServer server(80);

void setup() {
  // put your setup code here, to run once:
  pinMode(13, OUTPUT);
  Serial.begin(9600);

  Serial.print("connecting to ");
  Serial.println(ssid);

  while(WiFi.begin(ssid, password) != WL_CONNECTED) {
    delay(1000);
    Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connected.");
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

  server.on("/", handleRoot);
  server.begin();

  Serial.println("Server started.");
}

void loop() {
  server.handleClient();
}

void handleRoot() {
  if(server.hasArg("button")) {
    String buttonValue = server.arg("button");
    Serial.println("Button pressed: " + buttonValue);
  } else {
    Serial.println("No button pressed");
  }
  String html = "<html><body>"
                "<form action='/' method='POST'>"
                "<button name='button' value='Button1'?Button 1</button?"
                "<button name='button' value='Button2'?Button 2</button?"
                "</form>"
                "</body></html>";
  server,send(200, "text/html", html);
}

Won't compile

I don't see anything in the examples that will help me read the response from the client.

Not exactly a webserver then, ok..
did you look at all the examples??
WiFiS3 examples
There are a few Web client examples in there too..

~q

there is no WebServer library for Uno R4 WiFi. never was

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.