IoT Change event doesn't work when compiled using IDE

Hi. I'm new to this forum so I apologise if I do anything incorrectly.
I have a NANO 33 IoT with a very simple program to turn a LED on and off via a dashboard.
If I upload it to the board using the IoT Cloud Editor, it works fine. However, if I pull the same sketch into IDE 2.0 and upload it to the board, it doesn't work.
Using both methods, I get confirmation of Device ID, MQTT broker, that it is connected to my WiFi and connected to Arduino IoT Cloud. However, after uploading using IDE, the 'Thing ID' is blank.
Can anyone help please?
Thanks in advance

Hi @terrymann. I'm going to ask you to post some additional information that might help us to identify the problem.


:exclamation: NOTE: These instructions will not solve the problem. They are only intended to possibly gather some more information about the problem, which might provide a clue that leads to a solution.


Please do this:

  1. Select File > Preferences from the Arduino IDE menus.
  2. Check the box next to "Show verbose output during: ☐ compilation".
  3. Click the OK button.
  4. Select Sketch > Verify/Compile from the Arduino IDE menus.
  5. Wait for the compilation to finish.
  6. Right click on the black "Output" pane at the bottom of the Arduino IDE window.
  7. From the context menu, click Copy All.
  8. Open a forum reply here by clicking the Reply button.
  9. Click the </> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
    Code block
  10. Press Ctrl+V.
    This will paste the compilation output into the code block.
  11. Move the cursor outside of the code tags before you add any additional text to your reply.
  12. Click the Reply button to post the output.

In case the output is longer than the forum software will allow to be added to a post, you can instead save it to a .txt file and then attach that file to a reply here:

  1. Open any text editor program.
  2. Paste the copied output into the text editor.
  3. Save the file in .txt format.
  4. Open a forum reply here by clicking the Reply button.
  5. Click the "Upload" icon (image) on the post composer toolbar:
    image
  6. Select the .txt file you saved.
  7. Click the Open button.
  8. Click the Reply button to publish the post.

Alternatively, instead of using the "Upload" icon on the post composer toolbar as described in steps (5) - (7) above, you can simply drag and drop the .txt file onto the post composer field to attach it.

Hi ptillisch,
Thank you for your swift reply. Unfortunately, when I paste the Output from the compilation, I get a message that there are too many characters. It also won't let me upload an attachment as it says I am a new user.
Is there anything you are looking for that will reduce the amount of text or is there another way to send the attachment?
Thanks

Hi @terrymann. I apologize for the inconvenience. I should have remembered about the restriction on attachments.

You have now been promoted from the forum software's "new user' trust level with the forum software so should no longer be restricted from making attachments. Please try again.

Please let me know if you have any questions or problems.

Thanks ptillisch. Please find file attached.
I notice when I re-run the compilation, I see some lines at the very beginning that don't appear in the text file. Is there a limitation on the Output window size?

terrymann_Verbose.txt (256.1 KB)

Excellent. The information I wanted from the output is shown here:

Using library ArduinoIoTCloud at version 1.3.1 in folder: C:\Users\Terry Mann\OneDrive\Documents\Arduino\libraries\ArduinoIoTCloud 
Using library Arduino_ConnectionHandler at version 0.6.5 in folder: C:\Users\Terry Mann\OneDrive\Documents\Arduino\libraries\Arduino_ConnectionHandler 
Using library WiFiNINA at version 1.8.13 in folder: C:\Users\Terry Mann\OneDrive\Documents\Arduino\libraries\WiFiNINA 
Using library Arduino_DebugUtils at version 1.1.0 in folder: C:\Users\Terry Mann\OneDrive\Documents\Arduino\libraries\Arduino_DebugUtils 
Using library RTCZero at version 1.6.0 in folder: C:\Users\Terry Mann\OneDrive\Documents\Arduino\libraries\RTCZero 
Using library ArduinoMqttClient at version 0.1.5 in folder: C:\Users\Terry Mann\OneDrive\Documents\Arduino\libraries\ArduinoMqttClient 
Using library ArduinoECCX08 at version 1.3.5 in folder: C:\Users\Terry Mann\OneDrive\Documents\Arduino\libraries\ArduinoECCX08 
Using library Wire at version 1.0 in folder: C:\Users\Terry Mann\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.13\libraries\Wire 
Using library SNU at version 1.0.2 in folder: C:\Users\Terry Mann\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.13\libraries\SNU 
Using library Adafruit_SleepyDog_Library at version 1.3.2 in folder: C:\Users\Terry Mann\OneDrive\Documents\Arduino\libraries\Adafruit_SleepyDog_Library 
Using library SPI at version 1.0 in folder: C:\Users\Terry Mann\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.13\libraries\SPI 

These are the versions of the "Thing" sketch's library dependencies that are installed on your computer. If you check the "Console: Show verbose output" box in the Arduino Web Editor preferences and compile the same sketch there, you can see the versions of those libraries it uses:

Using library arduinoiotcloud_1_7_0 at version 1.7.0 in folder: /home/builder/opt/libraries/arduinoiotcloud_1_7_0

Using library arduino_connectionhandler_0_6_6 at version 0.6.6 in folder: /home/builder/opt/libraries/arduino_connectionhandler_0_6_6

Using library wifinina_1_8_13 at version 1.8.13 in folder: /home/builder/opt/libraries/wifinina_1_8_13

Using library arduino_debugutils_1_3_0 at version 1.3.0 in folder: /home/builder/opt/libraries/arduino_debugutils_1_3_0

Using library rtczero_1_6_0 at version 1.6.0 in folder: /home/builder/opt/libraries/rtczero_1_6_0

Using library arduinoeccx08_1_3_6 at version 1.3.6 in folder: /home/builder/opt/libraries/arduinoeccx08_1_3_6

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

Using library arduinomqttclient_0_1_6 at version 0.1.6 in folder: /home/builder/opt/libraries/arduinomqttclient_0_1_6

Using library SNU at version 1.0.2 in folder: /home/builder/.arduino15/packages/arduino/hardware/samd/1.8.13/libraries/SNU

Using library adafruit_sleepydog_library_1_6_1 at version 1.6.1 in folder: /home/builder/opt/libraries/adafruit_sleepydog_library_1_6_1

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

Note that some of the versions used when compiling the sketch on your computer are significantly outdated compared to the versions used when compiling on Arduino Cloud (by default it always uses the latest versions).

So I think this is the explanation for the different results between the two. I'll provide instructions you can follow to update the libraries:

  1. Select Sketch > Include Library > Manage Libraries... from the Arduino IDE menus to open the "Library Manager" view in the left side panel.

  2. In the "Filter your search" field, type arduinoiotcloud

  3. Scroll down through the list of libraries until you see "ArduinoIoTCloud by Arduino"entry. Hover the mouse pointer over that entry.

  4. You will now see an "INSTALL" button appear at the bottom of the entry. Click the button.

  5. You will now get a dialog asking:

    Would you like to install all the missing dependencies?

    Click the "INSTALL ALL" button.

  6. Wait for the installation to finish.

Since all the libraries are dependencies of the "ArduinoIoTCloud" library, updating that library will also update all the other outdated libraries used by the sketch.

After that is finished, use the Arduino IDE to upload the sketch to your Nano 33 IoT. I think this time you will find that the behavior is identical compared to when you uploaded via Arduino Cloud.

Excellent observation. Yes there is. I also have noticed this and have it on my "to do" list to investigate increasing this.

It is possible to adjust it via the IDE's advanced settings. I got the information I needed from the output you provided, but in case anyone is inconvenienced by the current limit I'll share instructions for increasing it:

  1. Press the Ctrl+Shift+P keyboard shortcut (Command+Shift+P for macOS users) to open the "Command Palette".
  2. Select the "Preferences: Open Settings (UI)" command from the menu.
    A "Preferences" tab will now open.
  3. In the "Search Settings" field, type output.maxChannelHistory
  4. Increase the value of the "Output › Max Channel History" setting to something like 5000
  5. Click the X icon on the "Preferences" tab to close it.

The next time you compile a sketch with a lot of output, you should find that everything is available from the "Output" panel in the Arduino IDE window.

4 posts were split to a new topic: Library Manager is empty2

Hi ptillisch,
following on from your earlier post, I opened up IDE 1.8 and updated the libraries there. I then reopened the sketch in IDE 2.0 and ran the compilation with verbose enabled. Although it is now using the latest library files, I get a compilation error:

C:\Users\Terry Mann\AppData\Local\Temp\arduino-sketch-67C8A5DD37C1EEC8374804188F3E074E\libraries\ArduinoIoTCloud\objs.a(ArduinoIoTCloud.cpp.o): In function `ArduinoIoTCloudClass::ArduinoIoTCloudClass()':
C:\Users\Terry Mann\OneDrive\Documents\Arduino\libraries\ArduinoIoTCloud\src/ArduinoIoTCloud.cpp:31: undefined reference to `ArduinoIoTCloudTimeService()'
C:\Users\Terry Mann\AppData\Local\Temp\arduino-sketch-67C8A5DD37C1EEC8374804188F3E074E\libraries\ArduinoIoTCloud\objs.a(ArduinoIoTCloudTCP.cpp.o): In function `updateTimezoneInfo()':
C:\Users\Terry Mann\OneDrive\Documents\Arduino\libraries\ArduinoIoTCloud\src/ArduinoIoTCloud.h:109: undefined reference to `TimeService::setTimeZoneData(long, unsigned long)'
C:\Users\Terry Mann\AppData\Local\Temp\arduino-sketch-67C8A5DD37C1EEC8374804188F3E074E\libraries\ArduinoIoTCloud\objs.a(ArduinoIoTCloudTCP.cpp.o): In function `ArduinoIoTCloudTCP::handleMessage(int)':
C:\Users\Terry Mann\OneDrive\Documents\Arduino\libraries\ArduinoIoTCloud\src/ArduinoIoTCloudTCP.cpp:733: undefined reference to `TimeService::setTimeZoneData(long, unsigned long)'
C:\Users\Terry Mann\AppData\Local\Temp\arduino-sketch-67C8A5DD37C1EEC8374804188F3E074E\libraries\ArduinoIoTCloud\objs.a(ArduinoIoTCloudTCP.cpp.o): In function `ArduinoIoTCloudTCP::sendPropertyContainerToCloud(arduino::String, std::__cxx11::list<Property*, std::allocator<Property*> >&, unsigned int&)':
C:\Users\Terry Mann\OneDrive\Documents\Arduino\libraries\ArduinoIoTCloud\src/ArduinoIoTCloudTCP.cpp:746: undefined reference to `CBOREncoder::encode(std::__cxx11::list<Property*, std::allocator<Property*> >&, unsigned char*, unsigned int, int&, unsigned int&, bool)'
collect2.exe: error: ld returned 1 exit status

Using library ArduinoIoTCloud at version 1.7.0 in folder: C:\Users\Terry Mann\OneDrive\Documents\Arduino\libraries\ArduinoIoTCloud 
Using library Arduino_ConnectionHandler at version 0.6.6 in folder: C:\Users\Terry Mann\OneDrive\Documents\Arduino\libraries\Arduino_ConnectionHandler 
Using library WiFiNINA at version 1.8.13 in folder: C:\Users\Terry Mann\OneDrive\Documents\Arduino\libraries\WiFiNINA 
Using library Arduino_DebugUtils at version 1.3.0 in folder: C:\Users\Terry Mann\OneDrive\Documents\Arduino\libraries\Arduino_DebugUtils 
Using library RTCZero at version 1.6.0 in folder: C:\Users\Terry Mann\OneDrive\Documents\Arduino\libraries\RTCZero 
Using library ArduinoECCX08 at version 1.3.6 in folder: C:\Users\Terry Mann\OneDrive\Documents\Arduino\libraries\ArduinoECCX08 
Using library Wire at version 1.0 in folder: C:\Users\Terry Mann\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.13\libraries\Wire 
Using library ArduinoMqttClient at version 0.1.6 in folder: C:\Users\Terry Mann\OneDrive\Documents\Arduino\libraries\ArduinoMqttClient 
Using library SNU at version 1.0.2 in folder: C:\Users\Terry Mann\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.13\libraries\SNU 
Using library Adafruit_SleepyDog_Library at version 1.6.1 in folder: C:\Users\Terry Mann\OneDrive\Documents\Arduino\libraries\Adafruit_SleepyDog_Library 
Using library SPI at version 1.0 in folder: C:\Users\Terry Mann\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.13\libraries\SPI 
exit status 1

Compilation error: exit status 1

I don't understand why I should get the errors if it compiles using the IoT Cloud Editor. The output shows that the sketch is now using the latest library versions. Unfortunately, being new to this, although ultimately I would like to understand the errors, currently they are a bit beyond me. Please can you help?

Regarding the libraries not showing up in IDE 2.0, I will work through each library and see which one(s) are causing the issue.

Thanks for all your help on this. I very much appreciate it.

Hi ptillisch,
Some good news...
After emptying the entire library, I decided to allow IDE 2.0 to install the libraries. I can only imagine that another library was either missing (and got installed as a referenced library) or was updated, so my IoT sketch compiles without error.

The library that was causing the problem was the "BraccioRobot" library. Looking at the properties file, the authors name is "Stefan Strömberg". I believe the 'ö' may be the offending character?

Again, many thanks for all your help..

Great work on finding the problem library! I'm glad it is working now.

Regards,
Per

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