ArduinoIoTCloud update to 0.5.9 creates compiler errors

I seen a compile error in the online Create Editor, but then after updating the ArduinoIoTCloud library in the Arduino IDE, I am seeing the same error.
This is not seen with ArduinoIoTCloud 0.5.8

/home/jomoros/Arduino/MKRLED_mar18a/MKRLED_mar18a.ino: In function 'void setup()':
MKRLED_mar18a:53:49: error: cannot convert 'const char*' to 'DebugLevel' for argument '1' to 'void debugMessage(DebugLevel, char*, ...)'
   debugMessage("Return From IoT Cloud begin.", 2);
                                                 ^
Multiple libraries were found for "WiFi101.h"
 Used: /home/jomoros/Arduino/libraries/WiFi101
 Not used: /home/jomoros/Arduino/libraries/WiFi101-master
Multiple libraries were found for "Servo.h"
 Used: /home/jomoros/Arduino/libraries/Servo
 Not used: /home/jomoros/arduino-11232018/libraries/Servo
exit status 1
cannot convert 'const char*' to 'DebugLevel' for argument '1' to 'void debugMessage(DebugLevel, char*, ...)'

This is what is see from the online Arduino Editor

/home/builder/opt/arduino-builder/arduino-builder -compile -core-api-version 10611 -hardware /home/builder/opt/arduino-builder/hardware -hardware /home/builder/.arduino15/packages -tools /home/builder/opt/arduino-builder/tools -tools /home/builder/.arduino15/packages -built-in-libraries /home/builder/opt/libraries/latest -logger humantags -fqbn arduino:samd:mkr1000 -build-cache /tmp -build-path /tmp/266547630/build -verbose -prefs runtime.tools.i586-poky-linux-uclibc.path=/home/builder/.arduino15/packages/Intel/tools/i586-poky-linux-uclibc/1.6.2+1.0 -prefs runtime.tools.openocd.path=/home/builder/.arduino15/packages/arduino/tools/openocd/0.9.0-arduino6-static -prefs runtime.tools.sketchUploader.path=/home/builder/.arduino15/packages/Intel/tools/sketchUploader/1.6.2+1.0 -prefs runtime.tools.CMSIS.path=/home/builder/.arduino15/packages/arduino/tools/CMSIS/4.5.0 -prefs runtime.tools.nrf5x-cl-tools.path=/home/builder/.arduino15/packages/arduino/tools/nrf5x-cl-tools/9.3.1 -prefs runtime.tools.arduinoOTA.path=/home/builder/.arduino15/packages/arduino/tools/arduinoOTA/1.2.0 -prefs runtime.tools.arm-none-eabi-gcc.path=/home/builder/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1 -prefs runtime.tools.bossac.path=/home/builder/.arduino15/packages/arduino/tools/bossac/1.7.0 -prefs runtime.tools.arduino101load.path=/home/builder/.arduino15/packages/Intel/tools/arduino101load/2.0.1 -prefs runtime.tools.flashpack.path=/home/builder/.arduino15/packages/Intel/tools/flashpack/2.0.0 -prefs runtime.tools.avr-gcc.path=/home/builder/.arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2 -prefs runtime.tools.linuxuploader.path=/home/builder/.arduino15/packages/arduino/tools/linuxuploader/1.5.1 -prefs runtime.tools.arc-elf32.path=/home/builder/.arduino15/packages/Intel/tools/arc-elf32/1.6.9+1.0.1 -prefs runtime.tools.x86-linux-gcc.path=/home/builder/.arduino15/packages/arduino/tools/x86-linux-gcc/7.2.0 -prefs runtime.tools.dfu-util.path=/home/builder/.arduino15/packages/arduino/tools/dfu-util/0.9.0-arduino1 -prefs runtime.tools.core2-32-poky-linux.path=/home/builder/.arduino15/packages/Intel/tools/core2-32-poky-linux/1.6.2+1.0 -prefs runtime.tools.arm-linux-gcc.path=/home/builder/.arduino15/packages/arduino/tools/arm-linux-gcc/4.9.3 -prefs runtime.tools.avrdude.path=/home/builder/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino8 -prefs runtime.tools.CMSIS-Atmel.path=/home/builder/.arduino15/packages/arduino/tools/CMSIS-Atmel/1.1.0 -libraries /tmp/266547630/custom -libraries /tmp/266547630/pinned /tmp/266547630/MKRLED_mar18a

Multiple libraries were found for "Servo.h"

Used: /home/builder/opt/libraries/latest/servo_1_1_3

Not used: /home/builder/opt/libraries/latest/rokitsmart_1_0_9

Not used: /home/builder/opt/libraries/latest/printoo_library_1_0_2

Not used: /home/builder/opt/libraries/latest/evive_2_0_2

Using library ethernet_2_0_0 at version 2.0.0 in folder: /home/builder/opt/libraries/latest/ethernet_2_0_0

Using library SPI at version 1.0 in folder: /home/builder/.arduino15/packages/arduino/hardware/samd/1.6.20/libraries/SPI

/tmp/266547630/MKRLED_mar18a/MKRLED_mar18a.ino: In function 'void setup()':

/tmp/266547630/MKRLED_mar18a/MKRLED_mar18a.ino:55:49: error: cannot convert 'const char*' to 'DebugLevel' for argument '1' to 'void debugMessage(DebugLevel, char*, ...)'

debugMessage("Return From IoT Cloud begin.", 2);

^

exit status 1

If I drop the ArduinoIoTCloud lib to version 0.5.8 in the Create Editor the issue goes away. Something is broke in version 0.5.9.

Here's the relevant commit:

I don't know that it's correct to say "something is broke". I believe this was an intentional change. It is unfortunate that it was a breaking change, but I don't think it can be done any other way.

Typically, I like to see breaking changes to the public API communicated to the users by doing a major version bump any time a breaking change is made to the public API of a project, in accordance to the semver specification:

However, semver has a loophole:

Major version zero (0.y.z) is for initial development. Anything may change at any time. The public API should not be considered stable.

Since the ArduinoIoTCloud library is currently in beta, breaking changes may be made without a major version bump. When in beta stage, a seemingly minor version update from 0.5.8 to 0.5.9 might actually have major implications for your application and you would be wise to study the diff before updating to a new version.

hi @jomoengineer

in 0.5.9 we have overhauled our debug utilities to print out messages from within ArduinoIoTCloud.
being such method not officially documented but part of the debug process we implemented to give users some feedback, we haven't felt it was necessary to communicate this.

It seems you used debugMessage() in your setup, and this method has changed to support variadic arguments and a more solid structure for message type.
You are of course free to implement this method for your own use, but doing so you need to look out for breaking changes in undocumented API, such as in this case :slight_smile:

0.5.9 also introduces some other minor adjustments which make the source code more organised
Would you mind to share your code so I can help you address this?

ubidefeo:
being such method not officially documented

@ubidefeo debugMessage() is documented in the library's readme (incorrectly now):

Well, with the Arduino IDE and 0.5.8, the debug message report as warnings which include debug messages from the Arduino provided APIs which I am just mimicking.

Ex: From 0.5.8 ArduinoIoTCloud.cpp

debugMessage("Bogus NTP time from API, fallback to UDP method", 0);

Ex: From 0.5.9 ArduinoIoTCloud.cpp

    debugMessage(DebugLevel::Error, "Bogus NTP time from API, fallback to UDP method");

NOTE: The use of debugMessage is not new with 0.5.9 and propagate throughout most of the Arduino Cloud related code.

These are not my APIs; they were provided by Arduino, or whomever that is creating this code.
I've added the messages since there continues to be issues with the board connecting to the Arduino IoT Cloud and I wanted a way to debug what the heck was going on. Thus, I just used what was already being used in the Arduino Cloud code.

Warnings during compile with 0.5.8 which have been reported previously.

/home/jomoros/Arduino/MKRLED_mar18a/MKRLED_mar18a.ino: In function 'void setup()':
/home/jomoros/Arduino/MKRLED_mar18a/MKRLED_mar18a.ino:53:49: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
   debugMessage("Return From IoT Cloud begin.", 2);
                                                 ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/WiFiConnectionManager.cpp: In member function 'virtual void WiFiConnectionManager::check()':
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/WiFiConnectionManager.cpp:75:86: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
           debugMessage("Please update to the latest version for best performance.", 0);
                                                                                      ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/WiFiConnectionManager.cpp: In member function 'void WiFiConnectionManager::changeConnectionState(NetworkConnectionState)':
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/WiFiConnectionManager.cpp:143:48: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
       debugMessage("Attempting reconnection", 0);
                                                ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/WiFiConnectionManager.cpp:147:101: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
       debugMessage("WiFi Hardware failure.\nMake sure you are using a WiFi enabled board/shield.", 0);
                                                                                                     ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/WiFiConnectionManager.cpp:148:46: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
       debugMessage("Then reset and retry.", 0);
                                              ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/EthernetConnectionManager.cpp: In member function 'virtual void EthConnectionManager::check()':
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/EthernetConnectionManager.cpp:72:55: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
           debugMessage("No Ethernet chip connected", 0);
                                                       ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/EthernetConnectionManager.cpp:83:66: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
           debugMessage("Failed to configure Ethernet via dhcp", 0);
                                                                  ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/EthernetConnectionManager.cpp:125:54: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
         debugMessage("Acquiring Time from Network", 3);
                                                      ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/EthernetConnectionManager.cpp:155:50: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
         debugMessage("Attempting reconnection", 1);
                                                  ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp: In function 'long unsigned int getTime()':
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp:43:70: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
     debugMessage("Bogus NTP time from API, fallback to UDP method", 0);
                                                                      ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp: In member function 'int ArduinoIoTCloudClass::begin(Client&, String, uint16_t)':
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp:112:93: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
     debugMessage("Cryptography processor failure. Make sure you have a compatible board.", 0);
                                                                                             ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp:117:59: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
     debugMessage("Cryptography processor read failure.", 0);
                                                           ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp:123:71: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
     debugMessage("Cryptography certificate reconstruction failure.", 0);
                                                                       ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp:134:71: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
     debugMessage("Cryptography certificate reconstruction failure.", 0);
                                                                       ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp: In member function 'void ArduinoIoTCloudClass::connectionCheck()':
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp:397:49: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
       debugMessage("Cloud Error. Retrying...", 0);
                                                 ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp:401:39: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
       debugMessage(".", 4, false, true);
                                       ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp: In member function 'void ArduinoIoTCloudClass::setIoTConnectionState(ArduinoIoTConnectionStatus)':
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp:441:52: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
       debugMessage("Arduino, we have a problem.", 0);
                                                    ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp:444:59: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
       debugMessage("Connecting to Arduino IoT Cloud...", 0);
                                                           ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp:447:61: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
       debugMessage("Reconnecting to Arduino IoT Cloud...", 0);
                                                             ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp:450:55: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
       debugMessage("Connected to Arduino IoT Cloud", 0);
                                                       ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp:453:60: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
       debugMessage("Disconnected from Arduino IoT Cloud", 0);
                                                            ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp: In member function 'void ArduinoIoTCloudClass::printDebugInfo()':
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp:462:71: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
   debugMessage("***** Arduino IoT Cloud - configuration info *****", 2);
                                                                       ^
Sketch uses 149968 bytes (57%) of program storage space. Maximum is 262144 bytes.

pert:
@ubidefeo debugMessage() is documented in the library's readme (incorrectly now):
GitHub - arduino-libraries/ArduinoIoTCloud

Yeah, I don't think that data is valid with 0.5.9

debugMessage(char *_msg, uint8_t _debugLevel, bool _timestamp = true, bool _newline = true) is the method used to print debug messages on the physical serial. This helps providing troubleshooting information should anything go wrong.

With ArduinoCloudIoT 0.5.9 and the Arduino IDE, I changed the debugMessage entry I added in setup but there are still warnings for the debugMessage messages.

Build options changed, rebuilding all
/home/jomoros/Arduino/MKRLED_mar18a/MKRLED_mar18a.ino: In function 'void setup()':
/home/jomoros/Arduino/MKRLED_mar18a/MKRLED_mar18a.ino:53:65: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
   debugMessage(DebugLevel::Error, "Return From IoT Cloud begin.");
                                                                 ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/EthernetConnectionManager.cpp: In member function 'virtual void EthConnectionManager::check()':
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/EthernetConnectionManager.cpp:67:82: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
         debugMessage(DebugLevel::Info, "Eth hardware status(): %d", networkStatus);
                                                                                  ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/EthernetConnectionManager.cpp:69:71: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
           debugMessage(DebugLevel::Error, "No Ethernet chip connected");
                                                                       ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/EthernetConnectionManager.cpp:76:78: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
         debugMessage(DebugLevel::Info, "Eth link status(): %d", networkStatus);
                                                                              ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/EthernetConnectionManager.cpp:78:82: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
           debugMessage(DebugLevel::Error, "Failed to configure Ethernet via dhcp");
                                                                                  ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/EthernetConnectionManager.cpp:84:100: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
         debugMessage(DebugLevel::Error, "Ethernet shield recognized: ID", Ethernet.hardwareStatus());
                                                                                                    ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/EthernetConnectionManager.cpp:88:61: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
         debugMessage(DebugLevel::Info, "Connecting via dhcp");
                                                             ^

                                                                 ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp:398:55: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
       debugMessageNoTimestamp(DebugLevel::Verbose, ".");
                                                       ^

                                                                    ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp:438:75: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
       debugMessage(DebugLevel::Error, "Connecting to Arduino IoT Cloud...");
                                                                           ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp:441:77: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
       debugMessage(DebugLevel::Error, "Reconnecting to Arduino IoT Cloud...");
                                                                             ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp:444:71: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
       debugMessage(DebugLevel::Error, "Connected to Arduino IoT Cloud");
                                                                       ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp:447:76: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
       debugMessage(DebugLevel::Error, "Disconnected from Arduino IoT Cloud");
                                                                            ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp: In member function 'void ArduinoIoTCloudClass::printDebugInfo()':
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp:455:86: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
   debugMessage(DebugLevel::Info, "***** Arduino IoT Cloud - configuration info *****");
                                                                                      ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp:456:72: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
   debugMessage(DebugLevel::Info, "Device ID: %s", getDeviceId().c_str());
                                                                        ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp:457:70: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
   debugMessage(DebugLevel::Info, "Thing ID: %s", getThingId().c_str());
                                                                      ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/ArduinoIoTCloud.cpp:458:91: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
   debugMessage(DebugLevel::Info, "MQTT Broker: %s:%d", _brokerAddress.c_str(), _brokerPort);
 
      
                                                                             ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/WiFiConnectionManager.cpp:98:70: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
         debugMessage(DebugLevel::Verbose, "Connected to \"%s\"", ssid);
                                                                      ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/WiFiConnectionManager.cpp: In member function 'void WiFiConnectionManager::changeConnectionState(NetworkConnectionState)':
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/WiFiConnectionManager.cpp:121:66: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
       debugMessage(DebugLevel::Info, "Connecting to \"%s\"", ssid);
                                                                  ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/WiFiConnectionManager.cpp:128:75: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
       debugMessage(DebugLevel::Verbose, "WiFi.status(): %d", WiFi.status());
                                                                           ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/WiFiConnectionManager.cpp:129:73: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
       debugMessage(DebugLevel::Error, "Connection to \"%s\" lost.", ssid);
                                                                         ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/WiFiConnectionManager.cpp:130:64: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
       debugMessage(DebugLevel::Error, "Attempting reconnection");
                                                                ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/WiFiConnectionManager.cpp:134:117: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
       debugMessage(DebugLevel::Error, "WiFi Hardware failure.\nMake sure you are using a WiFi enabled board/shield.");
                                                                                                                     ^
/home/jomoros/Arduino/libraries/ArduinoIoTCloud/src/WiFiConnectionManager.cpp:135:62: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
       debugMessage(DebugLevel::Error, "Then reset and retry.");
                                                              ^
Sketch uses 149928 bytes (57%) of program storage space. Maximum is 262144 bytes.

However, semver has a loophole:Since the ArduinoIoTCloud library is currently in beta, breaking changes may be made without a major version bump. When in beta stage, a seemingly minor version update from 0.5.8 to 0.5.9 might actually have major implications for your application and you would be wise to study the diff before updating to a new version.
[/quote]

One note, with regards to the online Create Editor IDE, I did not perform the update. The update came automatically so I am unclear as to how I can diff the change in that case.

jomoengineer:
there are still warnings for the debugMessage messages.

You should be able to safely ignore those warnings.

jomoengineer:
One note, with regards to the online Create Editor IDE, I did not perform the update.

Yes, it’s a bit of a mixed blessing that Arduino Web Editor automatically updates the official and Library Manager libraries and always uses the newest version.

Luckily, Arduino Web Editor does have a feature that allows you to specify which version of the library should be used. This should prevent automatic updates. You do it by:

  • Select the Libraries tab from the menu on the left side of the screen.
  • Do a search for the library you want to control.
  • When you hover your mouse pointer over the library name in the search results, you’ll see an “Include” menu. Click on it.
  • Select the version you want your sketch to use.

This will add a comment and #include directive to the sketch:

// ArduinoIoTCloud - Version: 0.5.8
#include <ArduinoIoTCloud.h>

The comment is somewhat misleading. It actually doesn’t do anything effect. The magic is in a hidden file called sketch.json that contains metadata for the sketch. That’s where the library version is stored. This means that if you manually add a comment specifying the library version, or edit the existing comment, the Arduino Web Editor will merrily ignore it and go on using whatever version it was using before. The only way to set the version is via the library’s “Include” menu.

Anyway, the point is that if you set the specific library versions to be used, you won’t need to worry about automated updates modifying your code. One thing to keep in mind is that some libraries have dependencies on other libraries. So you would need to be sure to specify versions for those dependencies as well.

jomoengineer:
so I am unclear as to how I can diff the change in that case.

Now that you have locked your code into using a specific version of each library, you can update at your leisure. But you need to know when there is a new version to update to. When using the Arduino Web Editor, I’d say the best thing to do is to watch the GitHub repository of every library you want to monitor for new releases. You can select “Releases Only” from the repository’s Watch menu if you don’t also want to get notifications for all the other activity in the repository. This does require a GitHub account, but that’s free, easy to set up, and super useful.

You can often find the repository for libraries by clicking the “More info” link. However, the library author can point that link anywhere they like, so it won’t always get you there.
You can find the repository URL for all the libraries that are automatically updated by the Arduino Web Editor in the “repository” properties of this file:
http://downloads.arduino.cc/libraries/library_index.json

Note that hardware packages (e.g. Arduino SAMD Boards) also contain bundled architecture-specific libraries (e.g. SPI, Wire). It’s not possible to specify the versions of those libraries, since only one version is available at any given time. I also don’t know of any way to specify a hardware package version in Arduino Web Editor. So you’ll still get automatic updates of hardware packages, and the libraries that are bundled with them. For this reason, I would recommend that you also watch the hardware package repositories of all the boards you use. Here are the official Arduino hardware packages/cores:

Once you know there is a new version, you can get the diff by:

  • Open the home page of the GitHub repository.
  • Click on the “Releases” link in the menu bar.
  • Note the tag names shown to the right side of the version you’re currently using, and the version you’re considering updating to. There is a little price tag icon next to them. These are often not exactly the same as the version number shown in Arduino Web Editor. For example, Arduino Web Editor might show “1.0.0”, but the tag is named “v1.0.0”.
  • Go back to the home page of the repository
  • Click “New Pull Request”. I know, that seems weird, but we’re not going to be opening a pull request.
  • Click on the “base: master” menu.
  • Type the tag name of the version you are currently using.
  • From the menu below the input field, click on the tag name
  • Click on the “compare: master” menu.
  • Type the tag name of the version you are thinking of updating to.
  • From the menu below the input field, click on the tag name

You will now see a list of all the commits made between the two versions. You can click on any commit to see its diff, or the “Files changed” tab to see the total diff.

Yeah, thanks for posting what I already know.

But, how do I do a diff from the Create Editor or know there was an update outside of performing a manual check of the github repo? I think it is not possible.

Perhaps a notice showing there was update to the code or give the user an option to perform the update when one was available like with the Arduino IDE would be best.

jomoengineer:
Yeah, thanks for posting what I already know.

How on earth would I know what you already know. You said:

jomoengineer:
I am unclear as to how I can diff the change in that case.

That led me to believe that you didn't know how to get a diff.

Look, I took the time to try to help you out. In return I get some attitude from you. That doesn't make me feel very good.

jomoengineer:
But, how do I do a diff from the Create Editor

You can't of course. What could possibly make you think you could do a diff from Create Editor?

jomoengineer:
or know there was an update outside of performing a manual check of the github repo? I think it is not possible.

If you had bothered to read my last reply, you would know the answer to that question.

pert:
How on earth would I know what you already know. You said:That led me to believe that you didn't know how to get a diff.

You can't so don't assume.

pert:
Look, I took the time to try to help you out. In return I get some attitude from you. That doesn't make me feel very good.

Nothing I can say or do can make you feel anything. That is all on you. However, you may want to review your own posts and determine where the real attitude is coming from.

If you do not work for Arduino, I would prefer you did not respond to or post on anything I posts here.