Cannot connect to my WiFi at home

Hello,

I want to connect to the WiFi at home and using this code I got from the Internet. When
I compile it, I get the error message:

     exit status 1
    'class WiFiClass' has no member named 'mode'

So it does not recognize the line:

   WiFi.mode(WIFI_STA);

Any ideas of what goes wrong? Just look at the coding.

Greetings,
Thomas, DL3TL


/*
Transfer weather station data via WiFi to server
*/

#include "WiFi.h"
#include <WiFiClient.h>
#include <WiFiServer.h>
#include <WiFiUdp.h>

const char* ssid = "MagentaWLAN-R75V";
const char* password = "70767048290050865805";

// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {

WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);

if (WiFi.status() != WL_CONNECTED) {
BlinkErrorFast();
}
else {
WiFi.disconnect()
BlinkOK();
}

}

What model Arduino are you using and what WiFi hardware is connected to it? It looks like the sketch is for an ESP32. Did you select your ESP32 board before trying to compile? Different boards use different WiFi libraries.

Also: Google can't find "BlinkErrorFast" used anywhere on the internet.

Hello, thank you for your feed-back. I could resolve the issue in the mean-time. I load the wrong library. Now it works fine.

Greetins,
Thomas

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