Datenübertragung per WLAN

Hallo Ihr Spezialisten,
ich arbeite mich in die Programmierung des Arduino ein und habe ein Verständnisproblem.
Ich möchte Messdaten per WLAN zum Handy senden. Ich benutze ein Arduino UNO R4 WiFi und wollte das offizielle Beispiel von Arduino ausprobieren. Damit komme ich nicht klar.
Der Sketch ist fehlerfrei und nach dem Upload kommt im Monitor nur folgendes:

Ich hatte eigentlich andere Meldungen erwartet. Auf auf dem Handy kann ich auch keinen diesbezügliches WLAN finden. Offensichtlich habe ich hier ein grundlegendes Verständnisproblem, wie so eine Verbindung aufzubauen ist.

Der Sketch ist:

/*
  WiFi Web Server LED Blink

  A simple web server that lets you blink an LED via the web.
  This sketch will print the IP address of your WiFi module (once connected)
  to the Serial Monitor. From there, you can open that address in a web browser
  to turn on and off the LED_BUILTIN.

  If the IP address of your board is yourAddress:
  http://yourAddress/H turns the LED on
  http://yourAddress/L turns it off

  This example is written for a network using WPA encryption. For
  WEP or WPA, change the WiFi.begin() call accordingly.

  Circuit:
  * Board with NINA module (Arduino MKR WiFi 1010, MKR VIDOR 4000 and Uno WiFi Rev.2)
  * LED attached to pin 9

  created 25 Nov 2012
  by Tom Igoe

  Find the full UNO R4 WiFi Network documentation here:
  https://docs.arduino.cc/tutorials/uno-r4-wifi/wifi-examples#simple-webserver
 */

#include "WiFiS3.h"
#include "arduino_secrets.h" 

///////please enter your sensitive data in the Secret tab/arduino_secrets.h
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 keyIndex = 0;                 // your network key index number (needed only for WEP)

int led =  LED_BUILTIN;
int status = WL_IDLE_STATUS;
WiFiServer server(80);

void setup() {
  Serial.begin(9600);      // initialize serial communication
  pinMode(led, OUTPUT);      // set the LED pin mode

  // check for the WiFi module:
  if (WiFi.status() == WL_NO_MODULE) {
    Serial.println("Communication with WiFi module failed!");
    // don't continue
    while (true);
  }

  String fv = WiFi.firmwareVersion();
  if (fv < WIFI_FIRMWARE_LATEST_VERSION) {
    Serial.println("Please upgrade the firmware");
  }

  // attempt to connect to WiFi network:
  while (status != WL_CONNECTED) {
    Serial.print("Attempting to connect to Network named: ");
    Serial.println(ssid);                   // print the network name (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();                           // start the web server on port 80
  printWifiStatus();                        // you're connected now, so print out the status
}


void loop() {
  WiFiClient client = server.available();   // listen for incoming clients

  if (client) {                             // if you get a client,
    Serial.println("new client");           // print a message out the serial port
    String currentLine = "";                // make a String to hold incoming data from the client
    while (client.connected()) {            // loop while the client's connected
      if (client.available()) {             // if there's bytes to read from the client,
        char c = client.read();             // read a byte, then
        Serial.write(c);                    // print it out to the serial monitor
        if (c == '\n') {                    // if the byte is a newline character

          // if the current line is blank, you got two newline characters in a row.
          // that's the end of the client HTTP request, so send a response:
          if (currentLine.length() == 0) {
            // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
            // and a content-type so the client knows what's coming, then a blank line:
            client.println("HTTP/1.1 200 OK");
            client.println("Content-type:text/html");
            client.println();

            // the content of the HTTP response follows the header:
            client.print("<p style=\"font-size:7vw;\">Click <a href=\"/H\">here</a> turn the LED on<br></p>");
            client.print("<p style=\"font-size:7vw;\">Click <a href=\"/L\">here</a> turn the LED off<br></p>");
            
            // The HTTP response ends with another blank line:
            client.println();
            // break out of the while loop:
            break;
          } else {    // if you got a newline, then clear currentLine:
            currentLine = "";
          }
        } else if (c != '\r') {  // if you got anything else but a carriage return character,
          currentLine += c;      // add it to the end of the currentLine
        }

        // Check to see if the client request was "GET /H" or "GET /L":
        if (currentLine.endsWith("GET /H")) {
          digitalWrite(LED_BUILTIN, HIGH);               // GET /H turns the LED on
        }
        if (currentLine.endsWith("GET /L")) {
          digitalWrite(LED_BUILTIN, LOW);                // GET /L turns the LED off
        }
      }
      
    }
    // close the connection:
    client.stop();
    Serial.println("client disconnected");
  }
}

void printWifiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your board'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");
  // print where to go in a browser:
  Serial.print("To see this page in action, open a browser to http://");
  Serial.println(ip);
}

Kann mir jemand diesbezüglich auf die Sprünge helfen?

Danke.
Joachim

Das Sketch erstellt kein eigenes WLAN-Netzwerk – es verbindet sich mit einem bereits vorhandenen (Ihrem Router/Ihrer Box). Deshalb sehen Sie kein neues Netz auf dem Handy.

Die WLAN-Zugangsdaten (SSID und Passwort) müssen in der Datei arduino_secrets.h korrekt eingetragen sein. Sobald die Verbindung klappt, zeigt der Serielle Monitor die IP-Adresse an. Diese IP dann einfach im Browser des Handys öffnen – das Handy muss natürlich im selben WLAN sein.

Danke für den Tipp, aber ganz habe ich es wohl doch noch nicht begriffen. Mein WLAN kommt vom Telekom Router. Ich habe deshalb die SSID des Routers in der Form xxx.xxx.x.x und das 8-stellige Kennwort in die arduino_secrets.h eingetragen, aber die Reaktion bleibt die Gleiche. Oder habe ich die falschen Daten genommen? Wo fände ich die richtige SSID / Passwort?

SSID und Password sollten aus dem Router bekannt sein und müssen in Anführungszeichen gesetzt werden.

Und setze deinen Sketch bitte in Code-Tags. Das kannst du in deinem Eingangspost auch noch nachträglich geändert werden. Dann ist dieser auch besser lesbar und damit kann dir auch besser geholfen werden.

Gern, aber wie geht das mit den Code-Tags?
Zu meinem Thema: Ich habe jetzt noch einmal als SSID den WLAN-Namen genommen, den ich im Handy benutze und auch das dazu gehörige korrekte Passwort. Aber es ändert sich an der Reaktion des Programms nichts.
Der Sketch ist bestimmt in Ordnung, er ist ja original von Arduino. Ich mache wohl etwas gründlich falsch. Aber was?

Vor 19 Tagen wurde dir gezeigt wie das geht

Dann lies dir diesen Beitrag durch, da steht es drin.

Ach....ein Wiederholungstäter. :joy:

Und mit dieser Aussage hast du dich hier komplett disqualifiziert.

Ich hoffe so stimmt nun die Formatierung. Aber mein Problem bleibt. Was muss ich als SSID und Kennwort eintragen, damit der UNO sich verbindet?

/*
  WiFi Web Server LED Blink

  A simple web server that lets you blink an LED via the web.
  This sketch will print the IP address of your WiFi module (once connected)
  to the Serial Monitor. From there, you can open that address in a web browser
  to turn on and off the LED_BUILTIN.

  If the IP address of your board is yourAddress:
  http://yourAddress/H turns the LED on
  http://yourAddress/L turns it off

  This example is written for a network using WPA encryption. For
  WEP or WPA, change the WiFi.begin() call accordingly.

  Circuit:
  * Board with NINA module (Arduino MKR WiFi 1010, MKR VIDOR 4000 and Uno WiFi Rev.2)
  * LED attached to pin 9

  created 25 Nov 2012
  by Tom Igoe

  Find the full UNO R4 WiFi Network documentation here:
  https://docs.arduino.cc/tutorials/uno-r4-wifi/wifi-examples#simple-webserver
 */

#include "WiFiS3.h"

#include "arduino_secrets.h" 
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = "Landfunk"  ;        // your network SSID (name)
char pass[] = "1152Schwieger";    // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0;                 // your network key index number (needed only for WEP)

int led =  LED_BUILTIN;
int status = WL_IDLE_STATUS;
WiFiServer server(80);

void setup() {
  Serial.begin(9600);      // initialize serial communication
  pinMode(led, OUTPUT);      // set the LED pin mode

  // check for the WiFi module:
  if (WiFi.status() == WL_NO_MODULE) {
    Serial.println("Communication with WiFi module failed!");
    // don't continue
    while (true);
  }

  String fv = WiFi.firmwareVersion();
  if (fv < WIFI_FIRMWARE_LATEST_VERSION) {
    Serial.println("Please upgrade the firmware");
  }

  // attempt to connect to WiFi network:
  while (status != WL_CONNECTED) {
    Serial.print("Attempting to connect to Network named: ");
    Serial.println(ssid);                   // print the network name (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();                           // start the web server on port 80
  printWifiStatus();                        // you're connected now, so print out the status
}


void loop() {
  WiFiClient client = server.available();   // listen for incoming clients

  if (client) {                             // if you get a client,
    Serial.println("new client");           // print a message out the serial port
    String currentLine = "";                // make a String to hold incoming data from the client
    while (client.connected()) {            // loop while the client's connected
      if (client.available()) {             // if there's bytes to read from the client,
        char c = client.read();             // read a byte, then
        Serial.write(c);                    // print it out to the serial monitor
        if (c == '\n') {                    // if the byte is a newline character

          // if the current line is blank, you got two newline characters in a row.
          // that's the end of the client HTTP request, so send a response:
          if (currentLine.length() == 0) {
            // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
            // and a content-type so the client knows what's coming, then a blank line:
            client.println("HTTP/1.1 200 OK");
            client.println("Content-type:text/html");
            client.println();

            // the content of the HTTP response follows the header:
            client.print("<p style=\"font-size:7vw;\">Click <a href=\"/H\">here</a> turn the LED on<br></p>");
            client.print("<p style=\"font-size:7vw;\">Click <a href=\"/L\">here</a> turn the LED off<br></p>");
            
            // The HTTP response ends with another blank line:
            client.println();
            // break out of the while loop:
            break;
          } else {    // if you got a newline, then clear currentLine:
            currentLine = "";
          }
        } else if (c != '\r') {  // if you got anything else but a carriage return character,
          currentLine += c;      // add it to the end of the currentLine
        }

        // Check to see if the client request was "GET /H" or "GET /L":
        if (currentLine.endsWith("GET /H")) {
          digitalWrite(LED_BUILTIN, HIGH);               // GET /H turns the LED on
        }
        if (currentLine.endsWith("GET /L")) {
          digitalWrite(LED_BUILTIN, LOW);                // GET /L turns the LED off
        }
      }
      
    }
    // close the connection:
    client.stop();
    Serial.println("client disconnected");
  }
}

void printWifiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your board'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");
  // print where to go in a browser:
  Serial.print("To see this page in action, open a browser to http://");
  Serial.println(ip);
}

Unser auch.
Du schreibst ja nicht, welches Problem du jetzt hast.

HotSystems, na dann schaue mal zum Post #1, Post #3 und Post #5.

Echt jetzt. Du bist eine absolute Hilfe.
Du schreibst nur dass du deine Eingaben gemacht hast aber nicht was du danach machst. Sollen wir uns das wiedermal alles aus den Fingern saugen?
Oder wie hättest du das gern.
Nur du kannst auf deinen PC sehen.

Du schreibst nie, ob es Fehlermeldungen gibt oder was du auf dem seriellen Monitor siehst, oder was du siehst, wenn du die Website im Browser öffnest.

Also alles wie immer. Keine richtigen Informationen.

Also echt, HotSystems, lesen wäre empfehlenswert. In Post '1 siehst Du das Ergebnis des seriellen Montors, außerdem habe ich da geschrieben dass der Sketch fehlerfrei ist - es gibt also keine Fehlermeldung.
Und welche Webside soll ich öffenen? Das gehört wohl mit zu meiner Frage ais Post #1.

Nun werde mal nicht komisch.
Was du oben zeigst ist nicht der serielle Monitor.
Und wenn ein Sketch fehlerfrei ist, heißt es noch lange nicht, dass es keine Fehlermeldungen gibt.

Ok und deine Fragen müssen wir uns jetzt immer selbst erdenken.
Du solltest besser mal deinen Sketch lesen und versuchen zu verstehen. Da steht genau drin, was dieser macht, u.a. eine Website erstellen.
Aber lesen ist wohl eher dein Problem.

Hallo J-M-L Jackson,

Sie antworten erfreulich substanziell und sachlich. Vielleicht können Sie mir als Anfänger auf diesem Gebiet besser helfen als der komische HotSytems. Ich würde mich freuen.
Joachim

Und jetzt auch noch beleidigen, das kannst du.
Wenn du nicht in der Lage bist, Fragen zu beantworten, solltest du das hier mal lassen und dir ein anderes Hobby zulegen. Eines was du auch verstehst.

Du solltest die Einträge in arduino_secrets.h nicht direkt danach durch neue (andere?) Festlegungen in ssid und pass obsolet machen.

Der serielle Monitor sollte als erstes einen Text mit Attempting . .. zeigen. Dein Screenshot zeigt nur den Hochladevorgang an.

Das was du zeigst im Post #1ist nur hohlade Meldung, schalte mall in der IDE den Serial Monitor ein, es sollten irgend welche Meldungen gezeigt werden.
Im SerMon wird deine IP Adresse gezeigt was wurde dem Uno zugeteilt durch dein Router, mit der Adresse kanst sich mit dem Uno verbinden.

Wie schon geschrieben die Adresse wird im SerMon gezeigt.
Im Browser sccreibst du die auf ohne www, http also ohne alles nur die gezeigte Adresse zB. 192.168.56.78 danach Return, ok der Sketch zeigt das man die seit soll im Format
http:// deine IP
Aufrufen, so sollte im SerMon angezeigt werden.
Zu Info habe keinen Uno R4 Wifi, werde das mall später testen mit einem ESP32-S3.