"WL_NO_MODULE" was not declared in this scope

Hi, I have the code below which doesn't compile due to this error:

/private/var/folders/fr/z593mgld597gjz_k30hwlx8w0000gn/T/.arduinoIDE-unsaved2025128-1803-1x6mkvf.m7wx/sketch_feb28a/sketch_feb28a.ino:26:24: error: 'WL_NO_MODULE' was not declared in this scope
   26 |   if (WiFi.status() == WL_NO_MODULE) {
#include <WiFi.h> 

#define SECRET_SSID ""
#define SECRET_PASS ""

char ssid[] = SECRET_SSID;        // your network SSID (name)
char pass[] = SECRET_PASS;    // your network password (use for WPA, or use as key for WEP)
int status = WL_IDLE_STATUS;     // the WiFi radio's status

char server[] = "192.168.1.165";

WiFiClient client;

void setup() {
  delay(5000);

  Serial.begin(9600);
  
  while (!Serial);

  delay(3000);

  WiFi.begin(ssid, pass); 

  if (WiFi.status() == WL_NO_MODULE) {
    Serial.println("Communication with WiFi module failed!");

    while (true);
  }

  while (status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network:
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:
    delay(10000);

    Serial.print("You're connected to the network");
  
    printWifiData();
  }
}

void loop() {
  Serial.println("test");

  if (client.connect(server, 80)) {
    client.println("POST /TEMP");
      client.println("Host: 192.168.1.165");
      client.println("Connection: close");
      client.println("Temp: test");
  }

}


void printWifiData() {
  // print your board's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);
  Serial.println(ip);

  // print your MAC address:
  byte mac[6];
  WiFi.macAddress(Mac);
  Serial.print("MAC address: ");
  printMacAddress(Mac);
}

void printMacAddress(byte mac[]) {
  for (int i = 5; i >= 0; i--) {
    if (mac[i] < 16) {
      Serial.print("0");
    }
    Serial.print(mac[i], HEX);
    if (i > 0) {
      Serial.print(":");
    }
  }
  Serial.println();
}

How can I resolve this? Thank you.

You could begin by telling us which board you're compiling against.

My apologies, I'm using a Sparkfun Pro Micro ESP32.

And since the Pro Micro doesn't have built in WiFi, you must be using a separate WiFi board and library, which are...? Please don't make people dig for information you should be providing up front.

My apologies again, I should have specified I'm using a Pro Micro ESP32 which does have WiFi connectivity.

I have a Pro Micro sitting right in front of me. It does not have WiFi capability.

Ah, I see you aren't using a Pro Micro. You're using a Pro Micro ESP32. Well, good luck with that.

And you might want to check the WiFi library's header files. I believe wherever you got that sketch from hasn't done so and got the constant's name wrong.

My apologies, I revised my previous post with the proper name.

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