Problems compiling with ArduinoOTA; “‘class ArduinoOTAMdnsClass…has no member named ’ ”

Hi,
I hope that you can help me. Any ideas are welcome.

I would like to use the ArduinoOTA library with an ESP8266.
Unfortunately, I keep getting the same error message.

In file included from /Users/Documents/Arduino/SKETCH/INVIARE_SKETCH_FTP_SERVER/INVIARE_SKETCH_FTP_SERVER.ino:19:0:
/Users/Documents/Arduino/libraries/ArduinoOTA/src/ArduinoOTA.h:127:22: error: 'WiFiServer' was not declared in this scope
 ArduinoOTAMdnsClass <WiFiServer, WiFiClient, WiFiUDP> ArduinoOTA;
                      ^
/Users/Documents/Arduino/libraries/ArduinoOTA/src/ArduinoOTA.h:127:34: error: 'WiFiClient' was not declared in this scope
 ArduinoOTAMdnsClass <WiFiServer, WiFiClient, WiFiUDP> ArduinoOTA;
                                  ^
/Users/Documents/Arduino/libraries/ArduinoOTA/src/ArduinoOTA.h:127:53: error: template argument 1 is invalid
 ArduinoOTAMdnsClass <WiFiServer, WiFiClient, WiFiUDP> ArduinoOTA;
                                                     ^
/Users/Documents/Arduino/libraries/ArduinoOTA/src/ArduinoOTA.h:127:53: error: template argument 2 is invalid
/Users/Documents/Arduino/libraries/ArduinoOTA/src/ArduinoOTA.h:127:65: error: invalid type in declaration before ';' token
 ArduinoOTAMdnsClass <WiFiServer, WiFiClient, WiFiUDP> ArduinoOTA;
                                                                 ^
In file included from /Users/Documents/Arduino/libraries/WiFiNINA/src/WiFiStorage.h:23:0,
                 from /Users/Documents/Arduino/libraries/WiFiNINA/src/WiFi.h:38,
                 from /Users/Documents/Arduino/libraries/WiFiNINA/src/WiFiNINA.h:23,
                 from /Users/Documents/Arduino/SKETCH/INVIARE_SKETCH_FTP_SERVER/INVIARE_SKETCH_FTP_SERVER.ino:20:
/Users/Documents/Arduino/libraries/WiFiNINA/src/utility/wifi_drv.h:293:12: error: 'PinStatus' does not name a type
     static PinStatus digitalRead(uint8_t pin);
            ^
Più di una libreria trovata per "WiFiUdp.h"
Usata: /Users/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/libraries/ESP8266WiFi
Non usata: /Applications/Arduino.app/Contents/Java/libraries/WiFi
Non usata: /Users/Documents/Arduino/libraries/WiFiNINA
Non usata: /Users/Documents/Arduino/libraries/WiFi101
exit status 1
Errore durante la compilazione per la scheda NodeMCU 1.0 (ESP-12E Module).

Unfortunately I don't know what this means.

I also already reinstalled all used libraries and read dozens of forums.
Unfortunately I could not find an answer.

I did the following steps:

  1. remove ArduinoOTA library in
  2. copy the platform.local.txt file to the boards folder

as the official documentation says: https://github.com/JAndrassy/ArduinoOTA

Did you have this problem before or do you have an idea for a solution ?
I am glad about every answer!

PS: the code is the example from the library.

try to compile first one of the example of the library. if it does not work, you've done something wrong. if it does work, then your code — which we don't see (hint) — will likely be the culprit

include the Ethernet library before ArduinoOTA include, if you want to use it with Ethernet.
for WiFi OTA use the esp8266 bundled ArduinoOTA library

i am testing the library examples but it doesn't work

If i use the esp8266 bundled ArduinoOTA library i get this error:


/Users/Documents/Arduino/SKETCH/INVIARE_SKETCH_FTP_SERVER/INVIARE_SKETCH_FTP_SERVER.ino: In function 'void handleSketchDownload()':
INVIARE_SKETCH_FTP_SERVER:76:8: error: 'InternalStorage' was not declared in this scope
   76 |   if (!InternalStorage.open(length)) {
      |        ^~~~~~~~~~~~~~~
INVIARE_SKETCH_FTP_SERVER:85:5: error: 'InternalStorage' was not declared in this scope
   85 |     InternalStorage.write(b);
      |     ^~~~~~~~~~~~~~~
INVIARE_SKETCH_FTP_SERVER:88:3: error: 'InternalStorage' was not declared in this scope
   88 |   InternalStorage.close();
      |   ^~~~~~~~~~~~~~~
Più di una libreria trovata per "ArduinoOTA.h"
Usata: /Users/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/libraries/ArduinoOTA
Non usata: /Users/Documents/Arduino/libraries/ArduinoOTA
exit status 1
'InternalStorage' was not declared in this scope

this is my sketch:

#include <ArduinoOTA.h> // only for InternalStorage
#include <WiFiNINA.h>
#include <ArduinoHttpClient.h>


const short VERSION = 1;

const char MY_SSID[] = "V-Home"; // Loaded from arduino_secrets.h
const char MY_PASS[] = ""; // Loaded from arduino_secrets.h

WiFiClient    wifiClient;  // HTTP
//WiFiSSLClient wifiClientSSL;  // HTTPS
int status = WL_IDLE_STATUS;

void handleSketchDownload() {
  const char* SERVER = "192.168.1.247";  // Set your correct hostname
  const unsigned short SERVER_PORT = 88888;     // Commonly 80 (HTTP) | 443 (HTTPS)
  const char* PATH = "/update-v%d.bin";       // Set the URI to the .bin firmware
  const unsigned long CHECK_INTERVAL = 6000;  // Time interval between update checks (ms)

  // Time interval check
  static unsigned long previousMillis;
  unsigned long currentMillis = millis();
  if (currentMillis - previousMillis < CHECK_INTERVAL)
    return;
  previousMillis = currentMillis;

  HttpClient client(wifiClient, SERVER, SERVER_PORT);  // HTTP
  //HttpClient client(wifiClientSSL, SERVER, SERVER_PORT);  // HTTPS

  char buff[32];
  snprintf(buff, sizeof(buff), PATH, VERSION + 1);

  Serial.print("Check for update file ");
  Serial.println(buff);

  // Make the GET request
  client.get(buff);

  int statusCode = client.responseStatusCode();
  Serial.print("Update status code: ");
  Serial.println(statusCode);
  if (statusCode != 200) {
    client.stop();
    return;
  }

  long length = client.contentLength();
  if (length == HttpClient::kNoContentLengthHeader) {
    client.stop();
    Serial.println("Server didn't provide Content-length header. Can't continue with update.");
    return;
  }
  Serial.print("Server returned update file of size ");
  Serial.print(length);
  Serial.println(" bytes");

  if (!InternalStorage.open(length)) {
    client.stop();
    Serial.println("There is not enough space to store the update. Can't continue with update.");
    return;
  }
  byte b;
  while (length > 0) {
    if (!client.readBytes(&b, 1)) // reading a byte with timeout
      break;
    InternalStorage.write(b);
    length--;
  }
  InternalStorage.close();
  client.stop();
  if (length > 0) {
    Serial.print("Timeout downloading update file at ");
    Serial.print(length);
    Serial.println(" bytes. Can't continue with update.");
    return;
  }

  Serial.println("Sketch update apply and reset.");
  Serial.flush();
  InternalStorage.apply(); // this doesn't return
}

void setup() {

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

  Serial.print("Sketch version ");
  Serial.println(VERSION);

  Serial.println("Initialize WiFi");
  // attempt to connect to Wifi network:
  while (status != WL_CONNECTED) {
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(MY_SSID);
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    status = WiFi.begin(MY_SSID, MY_PASS);
  }
  Serial.println("WiFi connected");
}

void loop() {
  // check for updates
  handleSketchDownload();

  // add your normal loop code below ...
}
  1. the networking library must be included before ArduinoOTA.h
  2. WiFiNINA is not for esp8266
  3. to store and apply the update binary, use on esp8266 the Update object from core

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