Hi @Martian_Tripod101. I apologize for the trouble caused by the bug in the "Arduino_ScienceKitCarrier" library. I'll provide instructions you can follow to work around the problem:
- Click the following link to download a version of the Arduino_ScienceKitCarrier library in which I have made a patch to fix the bug:
Arduino_ScienceKitCarrier.zip (62.8 KB)
Your web browser will start a file download.
- Open the "ScienceJournal" sketch in Arduino Cloud Editor, just as you did before when you encountered the error.
- Click the icon that looks like shelved books ("Libraries") in the bar on the left side of the Cloud Editor page.
The "Libraries" panel will open.
- Click the upward pointing arrow icon at the top of the "Libraries" panel.
The "Open" dialog will open.
- Select the
Arduino_ScienceKitCarrier.zip file that was downloaded at step 1 of these instructions in the dialog.
- Click the "Open" button.
The "Open" dialog will close.
- You will now see an indicator at the top of the "Libraries" panel in place of the upward pointing arrow icon as the library is imported. Wait for this indicator to disappear.
Now upload the "ScienceJournal" sketch to your Nano RP2040 Connect board, just as you did before when you encountered the error. Hopefully this time everything will work ae expected.
ⓘ If you later decide you want to remove the imported library from your Arduino Cloud account, you will find it under the "Custom" tab of the "Libraries" panel.
Please let us know if you have any questions or problems while following those instructions.
Technical Details
In case you are curious about the technical details, I'll provide an explanation of the bug and its fix below. If you aren't interested, feel free to skip reading it.
Explanation of Bug
The Arduino_ScienceKitCarrier library has a dependency on the OneWireNg library. The developer of the Arduino_ScienceKitCarrier library referenced that dependency with the following #include directive:
This #include directive uses a relative path. That assumes the installation of the OneWireNg library will be at a specific path relative to the installation of the Arduino_ScienceKitCarrier library. That assumption holds true when using Arduino IDE, and in the equivalent environment used by the library's continuous integration system. However, it does not hold true for Arduino Cloud. On the Arduino Cloud server, the Arduino_ScienceKitCarrier.h file that contains the problematic #include directive is at this path:
/var/run/arduino/directories-user/libraries/Arduino_ScienceKitCarrier/src/Arduino_ScienceKitCarrier.h
While the reference header file is at this path:
/run/arduino/directories-data/internal/OneWireNg_0.14.1_37fe3dc3c2e551b0/src/platform/OneWireNg_PicoRP2040.h
So this is why compilation of the sketch via Arduino Cloud Editor fails with that "No such file or directory" error.
Fix
The fix is to avoid any assumption of the relative location of the referenced header file, and instead utilize the standard "library discovery" feature of the Arduino sketch build system.
When an #include directive does only specifies a header filename, the sketch build system searches through the installed libraries to find the library that provides that header file.
So we might expect that the fix could be accomplished like so:
--- a/src/Arduino_ScienceKitCarrier.h
+++ b/src/Arduino_ScienceKitCarrier.h
@@ -43,7 +43,7 @@
#include "Arduino_BMI270_BMM150.h"
#ifdef ARDUINO_NANO_RP2040_CONNECT
-#include "../../OneWireNg/src/platform/OneWireNg_PicoRP2040.h" // forces to use gpio instead PIO hw
+#include <platform/OneWireNg_PicoRP2040.h> // forces to use gpio instead PIO hw
#define OneWireNg_CurrentPlatform OneWireNg_PicoRP2040
#endif
#ifdef ARDUINO_NANO_ESP32
However, this is not sufficient. The problem is that, for the sake of efficiency, discovery is only performed for header files present in the root of the target library's source code folder. In this case, the #include directive is targeting a header file present under the platform subfolder of the source folder, so this header file will not serve to achieve discovery of the OneWireNg library.
For this reason, it is necessary to add an additional #include directive for a header file that is present in the root of the library's source folder. If that #include directive is placed before the directive for the file in the subfolder, then the subsequent #include directive will work as intended because the library has already been discovered (and thus added to the compiler's "search path"). The OneWireNg.h header file serves as a suitable discovery target. Thus the fix looks like so:
--- a/src/Arduino_ScienceKitCarrier.h
+++ b/src/Arduino_ScienceKitCarrier.h
@@ -43,7 +43,8 @@
#include "Arduino_BMI270_BMM150.h"
#ifdef ARDUINO_NANO_RP2040_CONNECT
-#include "../../OneWireNg/src/platform/OneWireNg_PicoRP2040.h" // forces to use gpio instead PIO hw
+#include <OneWireNg.h>
+#include <platform/OneWireNg_PicoRP2040.h> // forces to use gpio instead PIO hw
#define OneWireNg_CurrentPlatform OneWireNg_PicoRP2040
#endif
#ifdef ARDUINO_NANO_ESP32