0Pricing
Arduino & IoT Academy · Lektion

ArduinoOTA aktivieren

Fügen Sie OTA-Unterstützung hinzu und laden Sie über WiFi hoch.

ArduinoOTA aktivieren ist eine kostenlose Arduino & IoT Academy-Lektion auf CoddyKit. Dies ist Lektion 2 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Arduino & IoT Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Arduino & IoT Academy-Kurs umfasst insgesamt 4 Lektionen.

Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.

Meet ArduinoOTA

The simplest way to update over WiFi is the ArduinoOTA library. It makes your board appear as a network port inside the Arduino IDE.

Include the Library

OTA rides on WiFi, so you pull in both headers at the top of your sketch before anything else runs.

#include <WiFi.h>
#include <ArduinoOTA.h>

Connect First

OTA can only work once you are online. In setup you join WiFi with your network name and password before starting OTA.

WiFi.begin("MyNetwork", "secret123");
while (WiFi.status() != WL_CONNECTED) { delay(500); }

Start the Service

One call wakes the updater. ArduinoOTA.begin() registers your board on the network so the IDE can find it.

ArduinoOTA.begin();

Give It a Name

Set a clear hostname so your device is easy to spot in the IDE's port list, especially when several boards share one network.

ArduinoOTA.setHostname("living-room-sensor");

Protect It With a Password

Always set an OTA password so a stranger on your WiFi cannot push their own code to your hardware.

ArduinoOTA.setPassword("flashMe!");

Handle OTA in the Loop

The updater is not automatic. You must call ArduinoOTA.handle() on every pass of loop so it can listen for an incoming upload.

void loop() {
  ArduinoOTA.handle();
}

Never Block the Loop

A long delay starves handle() and the upload fails. Keep loop quick so OTA always gets a chance to respond.

Watch the Progress

You can attach callbacks like onProgress to print how much of the new firmware has arrived during an upload.

ArduinoOTA.onProgress([](unsigned int p, unsigned int t) {
  Serial.printf("%u%%\n", (p * 100) / t);
});

Find the Network Port

After uploading once by USB, open the IDE's port menu. Your named board appears under network ports, ready for wireless flashing. 📶

Upload Wirelessly

Pick the network port, hit upload, and enter your password. From now on, new code flows entirely over the air.

Quick Check

One method must run constantly for OTA to work.

Recap

Include ArduinoOTA, connect to WiFi, call begin() with a hostname and password, then run handle() every loop to flash your board wirelessly. ✅

Häufig gestellte Fragen

Ist die Lektion „ArduinoOTA aktivieren“ kostenlos?

Ja — der vollständige Text von „ArduinoOTA aktivieren“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Arduino & IoT Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Arduino & IoT Academy-Kurs umfasst insgesamt 4 Lektionen.

Was lerne ich in „ArduinoOTA aktivieren“?

Fügen Sie OTA-Unterstützung hinzu und laden Sie über WiFi hoch. Du übst Arduino & IoT Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.

Brauche ich Erfahrung, um Arduino & IoT Academy zu starten?

Keine Vorkenntnisse erforderlich. Arduino & IoT Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 2 von 4.

Wie lange dauert die Lektion „ArduinoOTA aktivieren“?

Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.

Kann ich in dieser Arduino & IoT Academy-Lektion Code schreiben und ausführen?

Ja. Jede Arduino & IoT Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.

Alle Lektionen in diesem Kurs

  1. Warum OTA im Feld wichtig ist
  2. ArduinoOTA aktivieren
  3. Eine Web-Update-Seite bereitstellen
  4. Ein fehlerhaftes Update zurückrollen
← Zurück zu Arduino & IoT Academy