Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <WiFi.h>
- #include <ArduinoOTA.h>
- const char* ssid = "Your_SSID";
- const char* password = "Your_PASSWORD";
- void setup() {
- Serial.begin(115200);
- // Connect to Wi-Fi
- WiFi.begin(ssid, password);
- while (WiFi.status() != WL_CONNECTED) {
- delay(1000);
- Serial.println("Connecting to WiFi...");
- }
- Serial.println("Connected to WiFi");
- // Start OTA
- ArduinoOTA.begin();
- Serial.println("OTA Ready");
- // Optional: Set Hostname and Password
- // ArduinoOTA.setHostname("esp32-ota");
- // ArduinoOTA.setPassword("admin");
- }
- void loop() {
- // Handle OTA Updates
- ArduinoOTA.handle();
- // Your code here (e.g., blink an LED)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement