I get similar errors on other ESP32 Example WiFi sketches. Is this a screwed up library issue possibly?
ESP/espressif software library installed in Library Mgr as well as github json link in Preferences.
IDE 1.8.19/ Ubuntu Linux 20.04 LTS
t#include <WiFiLink.h>
char ssid[] = "xxxxxxxxxxx"; // your network SSID (name)
char pass[] = "xxxxxxxxxx"; // your network password
int keyIndex = 0; // your network key Index number (needed only for WEP)
int status = WL_IDLE_STATUS;
WiFiServer server(80);
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
WiFiWebServer:31:12: error: cannot declare variable 'server' to be of abstract type 'WiFiServer'
WiFiServer server(80);
^~~~~~
In file included from /home/ed/Arduino/libraries/WiFi_Link/src/WiFiLink.h:38,
from /tmp/arduino_modified_sketch_592500/WiFiWebServer.ino:22:
/home/ed/Arduino/libraries/WiFi_Link/src/WiFiServer.h:31:7: note: because the following virtual functions are pure within 'WiFiServer':
class WiFiServer : public Server {
^~~~~~~~~~
In file included from /home/ed/.arduino15/packages/esp32/hardware/esp32/2.0.2/cores/esp32/Arduino.h:165,
from /tmp/arduino_build_890735/sketch/WiFiWebServer.ino.cpp:1:
/home/ed/.arduino15/packages/esp32/hardware/esp32/2.0.2/cores/esp32/Server.h:28:18: note: 'virtual void Server::begin(uint16_t)'
virtual void begin(uint16_t port=0) =0;
^~~~~
Using library WiFi_Link at version 1.0.1 in folder: /home/ed/Arduino/libraries/WiFi_Link
exit status 1
cannot declare variable 'server' to be of abstract type 'WiFiServer'
/tmp/arduino_modified_sketch_79363/WiFiWebServer.ino: In function 'void setup()':
WiFiWebServer:43:24: error: 'WL_NO_WIFI_MODULE_COMM' was not declared in this scope
if (WiFi.status() == WL_NO_WIFI_MODULE_COMM) {
^~~~~~~~~~~~~~~~~~~~~~
Multiple libraries were found for "WiFi.h"
Used: /home/ed/.arduino15/packages/esp32/hardware/esp32/2.0.2/libraries/WiFi
Not used: /home/ed/Arduino Install Point/arduino-1.8.19/libraries/WiFi
Not used: /home/ed/Arduino/libraries/WiFiNINA
WITHOUT 'WifiLink.h' error report:
/tmp/arduino_modified_sketch_913224/WiFiWebServer.ino: In function 'void setup()':
WiFiWebServer:43:24: error: 'WL_NO_WIFI_MODULE_COMM' was not declared in this scope
if (WiFi.status() == WL_NO_WIFI_MODULE_COMM) {
^~~~~~~~~~~~~~~~~~~~~~
Multiple libraries were found for "WiFi.h"
Used: /home/ed/.arduino15/packages/esp32/hardware/esp32/2.0.2/libraries/WiFi
Did you try the sketch I posted ? or just add the includes to your own code? (which you haven't actually posted in full - it's hard to debug anything with only part of the code).
Are you sure WiFiLink works with ESP boards? Why do you use that library?
"These #includes were used with your example:"
Yes, I used your example both with and without WifiLink.h
Full sketch code:
#include <WiFiLink.h>
char ssid[] = "yourNetwork"; // your network SSID (name)
char pass[] = "secretPassword"; // your network password
int keyIndex = 0; // your network key Index number (needed only for WEP)
int status = WL_IDLE_STATUS;
WiFiServer server(80);
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
//Check if communication with wifi module has been established
if (WiFi.status() == WL_NO_WIFI_MODULE_COMM) {
Serial.println("Communication with WiFi module not established.");
while (true); // don't continue:
}
// attempt to connect to Wifi network:
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
status = WiFi.begin(ssid, pass);
// wait 10 seconds for connection:
delay(10000);
}
server.begin();
// you're connected now, so print out the status:
printWifiStatus();
}
void loop() {
// listen for incoming clients
WiFiClient client = server.available();
if (client) {
Serial.println("new client");
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close"); // the connection will be closed after completion of the response
client.println("Refresh: 5"); // refresh the page automatically every 5 sec
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
// output the value of each analog input pin
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
int sensorReading = analogRead(analogChannel);
client.print("analog input ");
client.print(analogChannel);
client.print(" is ");
client.print(sensorReading);
client.println("<br />");
}
client.println("</html>");
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
}
else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
Serial.println("client disonnected");
}
}
void printWifiStatus() {
// print the SSID of the network you're attached to:
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// print your WiFi shield's IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print("signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");
}
I get the same result. This is frustrating with these library issues. I get compiler warnings about multiple wifi.h sources and hope things still work right. I have fresh installed IDE many times and would rather avoid that again but I am getting inceasingly proficient at doing it and making the Linux related adjustments to get things lined out correctly.
With the ESP32 the library files seem to be an ongoing issue from my perspective as a neophyte.
Thanks for guiding me along.... appreciate the assist...
Sorry did not mean to be ambiguous. The Example sketch compiled fine. Unfortunately it is not detecting my LAN router and linking but that is a different challenge. I have another sketch that links up just fine so go figure.
Ok cool... that code you have may have other issues given it is quite old.
There are a lot of ESP32 example sketches, so if you can get those working there is probably one that is close to what you want, that you can play around with.
LOL...that code IS a decade old. Trial and error is my only option as I am not a language programmer/coder by any stretch of the imagination. I know just enuf to be dangerous with things like going 'root' in Linux terminal. Lol ....thanks again..