Libraries and IoT - IOT not finding correct libraries

Hi,
I'm trying to used code that worked fine on Arduino IDE, but is being rejected by IoT. The error messages identify several problems:

  1. I was using MPU6050.h, but IoT substitutes a different one. It then complains about differences.

  2. It is also asking for libraries I've never used: "RTC.h", I think because it is linked to the substitue library it uses. I would prefer to use my original library, refer question 4 below.

  3. The IMU substitute library then does not accept some variables I have of int16_t or int32_t type.

  4. Most importantly, can I load the specific libraries I have onto IoT?

I would appreciate any help. Thanks!

Here are the error messages:

/home/builder/Arduino/libraries/grove_imu_9dof_1_0_0/I2Cdev.cpp: In static member function 'static int8_t I2Cdev::readBytes(uint8_t, uint8_t, uint8_t, uint8_t*, uint16_t)':
/home/builder/Arduino/libraries/grove_imu_9dof_1_0_0/I2Cdev.cpp:276:62: error: 'BUFFER_LENGTH' was not declared in this scope
             for (uint8_t k = 0; k < length; k += min(length, BUFFER_LENGTH)) {
                                                              ^~~~~~~~~~~~~
/home/builder/Arduino/libraries/grove_imu_9dof_1_0_0/I2Cdev.cpp:276:62: note: suggested alternative: 'I2C_BUFFER_LENGTH'
             for (uint8_t k = 0; k < length; k += min(length, BUFFER_LENGTH)) {
                                                              ^~~~~~~~~~~~~
                                                              I2C_BUFFER_LENGTH
/home/builder/Arduino/libraries/grove_imu_9dof_1_0_0/I2Cdev.cpp: In static member function 'static int8_t I2Cdev::readWords(uint8_t, uint8_t, uint8_t, uint16_t*, uint16_t)':
/home/builder/Arduino/libraries/grove_imu_9dof_1_0_0/I2Cdev.cpp:416:70: error: 'BUFFER_LENGTH' was not declared in this scope
             for (uint8_t k = 0; k < length * 2; k += min(length * 2, BUFFER_LENGTH)) {
                                                                      ^~~~~~~~~~~~~
/home/builder/Arduino/libraries/grove_imu_9dof_1_0_0/I2Cdev.cpp:416:70: note: suggested alternative: 'I2C_BUFFER_LENGTH'
             for (uint8_t k = 0; k < length * 2; k += min(length * 2, BUFFER_LENGTH)) {
                                                                      ^~~~~~~~~~~~~
                                                                      I2C_BUFFER_LENGTH
Multiple libraries were found for "MPU6050.h"
  Used: /home/builder/opt/libraries/grove_imu_9dof_1_0_0
  Not used: /home/builder/opt/libraries/mpu6050_1_0_0
Multiple libraries were found for "RTC.h"
  Used: /home/builder/.arduino15/packages/arduino/hardware/renesas_uno/1.0.4/libraries/RTC
  Not used: /home/builder/opt/libraries/m5core2_0_1_7
  Not used: /home/builder/opt/libraries/m5stickc_0_2_9
  Not used: /home/builder/opt/libraries/m5stickcplus_0_1_0
  Not used: /home/builder/opt/libraries/m5station_0_0_1
Error during build: exit status 1

/home/builder/Arduino/libraries/grove_imu_9dof_1_0_0/I2Cdev.cpp: In static member function 'static int8_t I2Cdev::readBytes(uint8_t, uint8_t, uint8_t, uint8_t*, uint16_t)':
/home/builder/Arduino/libraries/grove_imu_9dof_1_0_0/I2Cdev.cpp:276:62: error: 'BUFFER_LENGTH' was not declared in this scope
             for (uint8_t k = 0; k < length; k += min(length, BUFFER_LENGTH)) {
                                                              ^~~~~~~~~~~~~
/home/builder/Arduino/libraries/grove_imu_9dof_1_0_0/I2Cdev.cpp:276:62: note: suggested alternative: 'I2C_BUFFER_LENGTH'
             for (uint8_t k = 0; k < length; k += min(length, BUFFER_LENGTH)) {
                                                              ^~~~~~~~~~~~~
                                                              I2C_BUFFER_LENGTH
/home/builder/Arduino/libraries/grove_imu_9dof_1_0_0/I2Cdev.cpp: In static member function 'static int8_t I2Cdev::readWords(uint8_t, uint8_t, uint8_t, uint16_t*, uint16_t)':
/home/builder/Arduino/libraries/grove_imu_9dof_1_0_0/I2Cdev.cpp:416:70: error: 'BUFFER_LENGTH' was not declared in this scope
             for (uint8_t k = 0; k < length * 2; k += min(length * 2, BUFFER_LENGTH)) {
                                                                      ^~~~~~~~~~~~~
/home/builder/Arduino/libraries/grove_imu_9dof_1_0_0/I2Cdev.cpp:416:70: note: suggested alternative: 'I2C_BUFFER_LENGTH'
             for (uint8_t k = 0; k < length * 2; k += min(length * 2, BUFFER_LENGTH)) {
                                                                      ^~~~~~~~~~~~~
                                                                      I2C_BUFFER_LENGTH
Multiple libraries were found for "MPU6050.h"
  Used: /home/builder/opt/libraries/grove_imu_9dof_1_0_0
  Not used: /home/builder/opt/libraries/mpu6050_1_0_0
Multiple libraries were found for "RTC.h"
  Used: /home/builder/.arduino15/packages/arduino/hardware/renesas_uno/1.0.4/libraries/RTC
  Not used: /home/builder/opt/libraries/m5core2_0_1_7
  Not used: /home/builder/opt/libraries/m5stickc_0_2_9
  Not used: /home/builder/opt/libraries/m5stickcplus_0_1_0
  Not used: /home/builder/opt/libraries/m5station_0_0_1
Error during build: exit status 1
1 Like

Hi @donnybenettourist. Every one of the thousands of libraries in the Arduino Library Manager are pre-installed in Arduino Cloud.

This is very convenient because it means you don't need to worry about installing or updating the libraries. However, it can sometimes cause issues. The problem is that, for any common filename used in an #include directive in your sketch program, there may be multiple libraries that contain a file of that name. When this occurs, Arduino Cloud attempts to automatically pick the best library to use when compiling your sketch. It is pretty smart about this, but unfortunately doesn't always make the right choice.

I can provide instructions you can follow to force the intended library to be used, but I'll need a bit more information from you first:

Please tell me where I can get the library you used with Arduino IDE.

If you installed it using the Arduino IDE Library Manager, tell me the exact name of the library, as shown in Library Manager.

If you downloaded the library from the Internet, then provide the link to the page you downloaded it from.

You can import all your libraries.

The biggest problem with doing that is your account has a limited amount of storage space for your account's sketches and libraries. Some libraries take up a lot of space (often caused by supplemental files added by the library author) so they can eat up your storage allowance very quickly, leaving you with less space for sketches. Conversely, the pre-installed libraries do not count against your storage allowance.

The other thing you might find inconvenient about importing libraries is that you will need to manage updates of the libraries. The pre-installed libraries are constantly updated automatically as soon as the library author makes a new release.

2 Likes

Thankyou for your quick, detailed, thorough response!

I was given the library by an associate, I'm not sure where they got it.
image

Update: Opening up the .h file, I find:

// I2Cdev library collection - MPU6050 I2C device class
// Based on InvenSense MPU-6050 register map document rev. 2.0, 5/19/2011 (RM-MPU-6000A-00)
// 10/3/2011 by Jeff Rowberg <jeff@rowberg.net>
// Updates should (hopefully) always be available at https://github.com/jrowberg/i2cdevlib

OK, that should be sufficient.

Unfortunately the author of this library packaged it in a format that causes the procedure for importing it into Arduino Cloud somewhat complex. I'll provide detailed instructions. I'm confident that if you follow them carefully you will be successful:

Import MPU6050 Library

  1. Click the link below to download a library.properties metadata file I have prepared for the "MPU6050" library:
    library.properties (314 Bytes)
  2. Wait for the download to finish.
  3. Using the Windows "File Explorer", move the downloaded library.properties file to the same folder as the MPU6050.h file shown in your screenshot.
  4. Right click on the MPU6050 folder that contains the MPU6050.h file shown in your screenshot.
    A context menu will open.
  5. Select "Show more options" from the context menu.
    More options will be shown in the context menu.
  6. Select "Send to > Compressed (zipped) folder" from the context menu.
    A file named MPU6050.zip will be created.
  7. Click the link below to open "Arduino Web Editor" in your web browser:
    https://create.arduino.cc/editor
  8. Select "Libraries" from the menu on the left side of the "Arduino Web Editor" window to open the Libraries panel.
  9. Click the upward pointing arrow button ("Import") to the right side of the "Library Manager" button.
  10. If you get a popup about importing your sketchbook, click the "Import" button.
    A dialog will open that allows you to select a file on your computer to import to your Arduino Cloud account.
  11. Select the MPU6050.zip file that was created at step (6) of these instructions.
  12. Click the "Open" button.
  13. Wait for Arduino Web Editor to display the notification that the library was successfully imported.
  14. Click the "OK" button.

Import I2Cdev Library

The "MPU6050" library has a dependency on another library named "I2Cdev". You must also import that library to Arduino Cloud by following these instructions:

  1. Click the link below to download a library.properties metadata file I have prepared for the "I2Cdev" library:
    library.properties (305 Bytes)
  2. Wait for the download to finish.
  3. Using the Windows "File Explorer", move the downloaded library.properties file to the folder named I2Cdev that you will find in the same location as the MPU6050 folder shown in your screenshot.
  4. Right click on the I2Cdev folder.
    A context menu will open.
  5. Select "Show more options" from the context menu.
    More options will be shown in the context menu.
  6. Select "Send to > Compressed (zipped) folder" from the context menu.
    A file named I2Cdev.zip will be created.
  7. Click the link below to open "Arduino Web Editor" in your web browser:
    https://create.arduino.cc/editor
  8. Select "Libraries" from the menu on the left side of the "Arduino Web Editor" window to open the Libraries panel.
  9. Click the upward pointing arrow button ("Import") to the right side of the "Library Manager" button.
  10. If you get a popup about importing your sketchbook, click the "Import" button.
    A dialog will open that allows you to select a file on your computer to import to your Arduino Cloud account.
  11. Select the I2Cdev.zip file that was created at step (6) of these instructions.
  12. Click the "Open" button.
  13. Wait for Arduino Web Editor to display the notification that the library was successfully imported.
  14. Click the "OK" button.

After completing the instructions above, you should be able to compile your Arduino IoT Cloud Thing sketch without getting the error you encountered before.


Please let me know if you have any questions or problems while following those instructions.

1 Like

Thanks very much for all that! Very much appreciated!

1 Like

You are welcome. I'm glad if I was able to be of assistance.

Regards,
Per

2 Likes

Hi,
I followed your instructions and the files uploaded fine.
The error message still seems to be requesting the unused files. Is there a way to purge the unused ones?

/usr/local/bin/arduino-cli compile --fqbn arduino:renesas_uno:unor4wifi --build-cache-path /tmp --output-dir /tmp/2252413772/build --build-path /tmp/arduino-build-48CF3C9AF6746A5F4A255A5708207053 --library /mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev --library /mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev-MPU6050 /tmp/2252413772/Assignment_4_oct25a

/mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev/I2Cdev.cpp: In static member function 'static int8_t I2Cdev::readBytes(uint8_t, uint8_t, uint8_t, uint8_t*, uint16_t)':

/mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev/I2Cdev.cpp:276:62: error: 'BUFFER_LENGTH' was not declared in this scope

for (uint8_t k = 0; k < length; k += min(length, BUFFER_LENGTH)) {

^~~~~~~~~~~~~

/mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev/I2Cdev.cpp:276:62: note: suggested alternative: 'I2C_BUFFER_LENGTH'

for (uint8_t k = 0; k < length; k += min(length, BUFFER_LENGTH)) {

^~~~~~~~~~~~~

I2C_BUFFER_LENGTH

/mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev/I2Cdev.cpp: In static member function 'static int8_t I2Cdev::readWords(uint8_t, uint8_t, uint8_t, uint16_t*, uint16_t)':

/mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev/I2Cdev.cpp:414:70: error: 'BUFFER_LENGTH' was not declared in this scope

for (uint8_t k = 0; k < length * 2; k += min(length * 2, BUFFER_LENGTH)) {

^~~~~~~~~~~~~

/mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev/I2Cdev.cpp:414:70: note: suggested alternative: 'I2C_BUFFER_LENGTH'

for (uint8_t k = 0; k < length * 2; k += min(length * 2, BUFFER_LENGTH)) {

^~~~~~~~~~~~~

I2C_BUFFER_LENGTH

Multiple libraries were found for "MPU6050.h"

Used: /mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev-MPU6050

Not used: /home/builder/opt/libraries/mpu6050_1_0_0

Not used: /home/builder/opt/libraries/grove_imu_9dof_1_0_0

Multiple libraries were found for "I2Cdev.h"

Used: /mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev

Not used: /home/builder/opt/libraries/seeed_pca9685_0_0_1

Not used: /home/builder/opt/libraries/grove_motor_driver_tb6612fng_0_0_1

Not used: /home/builder/opt/libraries/mpu6050_1_0_0

Not used: /home/builder/opt/libraries/grove_imu_9dof_1_0_0

Multiple libraries were found for "RTC.h"

Used: /home/builder/.arduino15/packages/arduino/hardware/renesas_uno/1.0.4/libraries/RTC

Not used: /home/builder/opt/libraries/m5stickcplus_0_1_0

Not used: /home/builder/opt/libraries/m5station_0_0_1

Not used: /home/builder/opt/libraries/m5core2_0_1_7

Not used: /home/builder/opt/libraries/m5stickc_0_2_9

Error during build: exit status 1
1 Like

Update: I added
#include <12Cdev.h>

and the error list shrank:

Start verifying
/tmp/60109655/Assignment_4_oct25a/Assignment_4_oct25a.ino:4:10: fatal error: 12Cdev.h: No such file or directory
 #include <12Cdev.h>
          ^~~~~~~~~~
compilation terminated.
Multiple libraries were found for "MPU6050.h"
  Used: /mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev-MPU6050
  Not used: /home/builder/opt/libraries/mpu6050_1_0_0
  Not used: /home/builder/opt/libraries/grove_imu_9dof_1_0_0
Multiple libraries were found for "I2Cdev.h"
  Used: /mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev
  Not used: /home/builder/opt/libraries/mpu6050_1_0_0
  Not used: /home/builder/opt/libraries/grove_imu_9dof_1_0_0
  Not used: /home/builder/opt/libraries/seeed_pca9685_0_0_1
  Not used: /home/builder/opt/libraries/grove_motor_driver_tb6612fng_0_0_1
Error during build: exit status 1

/tmp/60109655/Assignment_4_oct25a/Assignment_4_oct25a.ino:4:10: fatal error: 12Cdev.h: No such file or directory
 #include <12Cdev.h>
          ^~~~~~~~~~
compilation terminated.
Multiple libraries were found for "MPU6050.h"
  Used: /mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev-MPU6050
  Not used: /home/builder/opt/libraries/mpu6050_1_0_0
  Not used: /home/builder/opt/libraries/grove_imu_9dof_1_0_0
Multiple libraries were found for "I2Cdev.h"
  Used: /mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev
  Not used: /home/builder/opt/libraries/mpu6050_1_0_0
  Not used: /home/builder/opt/libraries/grove_imu_9dof_1_0_0
  Not used: /home/builder/opt/libraries/seeed_pca9685_0_0_1
  Not used: /home/builder/opt/libraries/grove_motor_driver_tb6612fng_0_0_1
Error during build: exit status 1

A final suggestion/ question:
Would this 'memory' of previous libraries be deleted if built a different Thing and reassociated the Uno with it? Eg: Delete the current one under Things/Name and create a new Thing with same family and uploaded libraries?

The error is caused by a typo. The filename is I2Cdev.h, not 12Cdev.h (note that the first character is the letter I, not the number 1).

Fix that error and then try compiling again. I guess then you'll be back to getting the same error as before:

I can see from the code referenced in the error that the I2Cdev library you imported from your computer is different from the one I obtained from the link in the comment you shared:

When it worked fine on Arduino IDE, did you have Tools > Board > Arduino UNO R4 Boards > Arduino UNO R4 WiFi selected from the Arduino IDE menus, or were you compiling for a different board?

1 Like

Whoops!

Previously, with IDE, it was on a different board, neither official arduino or wifi.
You were right, the error is now only about missing libraries.

Should I just download and use the original libraries?
Also it keeps asking for RTC.h, when as far as I'm aware it doesn't need this.

Start verifying
/tmp/3710699467/Test_oct25a/Test_oct25a.ino: In function 'void loop()':
/tmp/3710699467/Test_oct25a/Test_oct25a.ino:158:3: error: 'output' was not declared in this scope
   output = KP*error + KD*(derivative_error) + KI*(integral_error); 
   ^~~~~~
Multiple libraries were found for "MPU6050.h"
  Used: /mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev-MPU6050
  Not used: /home/builder/opt/libraries/grove_imu_9dof_1_0_0
  Not used: /home/builder/opt/libraries/mpu6050_1_0_0
Multiple libraries were found for "I2Cdev.h"
  Used: /mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev
  Not used: /home/builder/opt/libraries/grove_imu_9dof_1_0_0
  Not used: /home/builder/opt/libraries/grove_motor_driver_tb6612fng_0_0_1
  Not used: /home/builder/opt/libraries/seeed_pca9685_0_0_1
  Not used: /home/builder/opt/libraries/mpu6050_1_0_0
Multiple libraries were found for "RTC.h"
  Used: /home/builder/.arduino15/packages/arduino/hardware/renesas_uno/1.0.4/libraries/RTC
  Not used: /home/builder/opt/libraries/m5station_0_0_1
  Not used: /home/builder/opt/libraries/m5stickc_0_2_9
  Not used: /home/builder/opt/libraries/m5core2_0_1_7
  Not used: /home/builder/opt/libraries/m5stickcplus_0_1_0
Error during build: exit status 1

/tmp/3710699467/Test_oct25a/Test_oct25a.ino: In function 'void loop()':
/tmp/3710699467/Test_oct25a/Test_oct25a.ino:158:3: error: 'output' was not declared in this scope
   output = KP*error + KD*(derivative_error) + KI*(integral_error); 
   ^~~~~~
Multiple libraries were found for "MPU6050.h"
  Used: /mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev-MPU6050
  Not used: /home/builder/opt/libraries/grove_imu_9dof_1_0_0
  Not used: /home/builder/opt/libraries/mpu6050_1_0_0
Multiple libraries were found for "I2Cdev.h"
  Used: /mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev
  Not used: /home/builder/opt/libraries/grove_imu_9dof_1_0_0
  Not used: /home/builder/opt/libraries/grove_motor_driver_tb6612fng_0_0_1
  Not used: /home/builder/opt/libraries/seeed_pca9685_0_0_1
  Not used: /home/builder/opt/libraries/mpu6050_1_0_0
Multiple libraries were found for "RTC.h"
  Used: /home/builder/.arduino15/packages/arduino/hardware/renesas_uno/1.0.4/libraries/RTC
  Not used: /home/builder/opt/libraries/m5station_0_0_1
  Not used: /home/builder/opt/libraries/m5stickc_0_2_9
  Not used: /home/builder/opt/libraries/m5core2_0_1_7
  Not used: /home/builder/opt/libraries/m5stickcplus_0_1_0
Error during build: exit status 1

The "Multiple libraries were found for ..." messages are not errors. This is only useful information provided by the Arduino sketch build system. They are normal and expected and you will see them very frequently even when using 100% functional sketches in Arduino Cloud.

The only time you need to worry about these "Multiple libraries were found for ..." messages is when they show that a different library was selected than the one you intended to be used. This is the reason why the messages are printed. So when you see one of these messages the first time, take a quick look. If the messages indicated that intended library was selected then everything is fine and you can ignore the message from then onward.

It does indeed need this. It is used by the ArduinoIoTCloud library, which is part of the automatically generated Arduino IoT Cloud Thing sketch code.

The message shows that the correct library is being used so you don't need to worry about it. Please just ignore that "Multiple libraries were found for "RTC.h"" message from here on.


This is the real error that you must pay attention to:

You have referenced a variable named output in your sketch code, but you never declared such a variable.

I'll provide a silly simple example:

void setup() {
  someVariable = 123;
}
void loop() {}

The sketch above is not valid code because I have referenced a variable named someVariable, but I never declared a variable of that name in my code. Attempting to compile that sketch will fail with a "not declared in this scope" error:

error: 'someVariable' was not declared in this scope
   someVariable = 123;
   ^~~~~~~~~~~~

The code can be fixed by adding a declaration for the someVariable variable, something like this:

void setup() {
  byte someVariable;
  someVariable = 123;
}
void loop() {}
1 Like

Thanks. I deleted 'output' when I first imported the file, thinking wrongly that the variables in the setup tab replaced it.

I have added it back.

There are now errors about

BUFFER_LENGTH' was not declared in this scope
             for (uint8_t k = 0; k < length; k += min(length, BUFFER_LENGTH))

Can this be ignored too? Or should I change the variable to be a unsigned long int32_t is causing problems?
The variables in question are:

int16_t   acx, acy, acz;
int32_t   sumac

When I verify now its only library references, finishing with "Error During Build: exit status 1"

If this is not a problem let me express my extreme gratitude for your help!

Bless you! Thank you so much!

Start verifying
/mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev/I2Cdev.cpp: In static member function 'static int8_t I2Cdev::readBytes(uint8_t, uint8_t, uint8_t, uint8_t*, uint16_t)':
/mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev/I2Cdev.cpp:276:62: error: 'BUFFER_LENGTH' was not declared in this scope
             for (uint8_t k = 0; k < length; k += min(length, BUFFER_LENGTH)) {
                                                              ^~~~~~~~~~~~~
/mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev/I2Cdev.cpp:276:62: note: suggested alternative: 'I2C_BUFFER_LENGTH'
             for (uint8_t k = 0; k < length; k += min(length, BUFFER_LENGTH)) {
                                                              ^~~~~~~~~~~~~
                                                              I2C_BUFFER_LENGTH
/mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev/I2Cdev.cpp: In static member function 'static int8_t I2Cdev::readWords(uint8_t, uint8_t, uint8_t, uint16_t*, uint16_t)':
/mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev/I2Cdev.cpp:414:70: error: 'BUFFER_LENGTH' was not declared in this scope
             for (uint8_t k = 0; k < length * 2; k += min(length * 2, BUFFER_LENGTH)) {
                                                                      ^~~~~~~~~~~~~
/mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev/I2Cdev.cpp:414:70: note: suggested alternative: 'I2C_BUFFER_LENGTH'
             for (uint8_t k = 0; k < length * 2; k += min(length * 2, BUFFER_LENGTH)) {
                                                                      ^~~~~~~~~~~~~
                                                                      I2C_BUFFER_LENGTH
Multiple libraries were found for "MPU6050.h"
  Used: /mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev-MPU6050
  Not used: /home/builder/opt/libraries/grove_imu_9dof_1_0_0
  Not used: /home/builder/opt/libraries/mpu6050_1_0_0
Multiple libraries were found for "I2Cdev.h"
  Used: /mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev
  Not used: /home/builder/opt/libraries/seeed_pca9685_0_0_1
  Not used: /home/builder/opt/libraries/grove_imu_9dof_1_0_0
  Not used: /home/builder/opt/libraries/grove_motor_driver_tb6612fng_0_0_1
  Not used: /home/builder/opt/libraries/mpu6050_1_0_0
Multiple libraries were found for "RTC.h"
  Used: /home/builder/.arduino15/packages/arduino/hardware/renesas_uno/1.0.4/libraries/RTC
  Not used: /home/builder/opt/libraries/m5core2_0_1_7
  Not used: /home/builder/opt/libraries/m5stickc_0_2_9
  Not used: /home/builder/opt/libraries/m5stickcplus_0_1_0
  Not used: /home/builder/opt/libraries/m5station_0_0_1
Error during build: exit status 1

/mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev/I2Cdev.cpp: In static member function 'static int8_t I2Cdev::readBytes(uint8_t, uint8_t, uint8_t, uint8_t*, uint16_t)':
/mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev/I2Cdev.cpp:276:62: error: 'BUFFER_LENGTH' was not declared in this scope
             for (uint8_t k = 0; k < length; k += min(length, BUFFER_LENGTH)) {
                                                              ^~~~~~~~~~~~~
/mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev/I2Cdev.cpp:276:62: note: suggested alternative: 'I2C_BUFFER_LENGTH'
             for (uint8_t k = 0; k < length; k += min(length, BUFFER_LENGTH)) {
                                                              ^~~~~~~~~~~~~
                                                              I2C_BUFFER_LENGTH
/mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev/I2Cdev.cpp: In static member function 'static int8_t I2Cdev::readWords(uint8_t, uint8_t, uint8_t, uint16_t*, uint16_t)':
/mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev/I2Cdev.cpp:414:70: error: 'BUFFER_LENGTH' was not declared in this scope
             for (uint8_t k = 0; k < length * 2; k += min(length * 2, BUFFER_LENGTH)) {
                                                                      ^~~~~~~~~~~~~
/mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev/I2Cdev.cpp:414:70: note: suggested alternative: 'I2C_BUFFER_LENGTH'
             for (uint8_t k = 0; k < length * 2; k += min(length * 2, BUFFER_LENGTH)) {
                                                                      ^~~~~~~~~~~~~
                                                                      I2C_BUFFER_LENGTH
Multiple libraries were found for "MPU6050.h"
  Used: /mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev-MPU6050
  Not used: /home/builder/opt/libraries/grove_imu_9dof_1_0_0
  Not used: /home/builder/opt/libraries/mpu6050_1_0_0
Multiple libraries were found for "I2Cdev.h"
  Used: /mnt/create-efs/webide/d6/af/d6afefe88bd3b1f5cb77586c3ad8a52a:donnybenettourist/libraries_v2/I2Cdev
  Not used: /home/builder/opt/libraries/seeed_pca9685_0_0_1
  Not used: /home/builder/opt/libraries/grove_imu_9dof_1_0_0
  Not used: /home/builder/opt/libraries/grove_motor_driver_tb6612fng_0_0_1
  Not used: /home/builder/opt/libraries/mpu6050_1_0_0
Multiple libraries were found for "RTC.h"
  Used: /home/builder/.arduino15/packages/arduino/hardware/renesas_uno/1.0.4/libraries/RTC
  Not used: /home/builder/opt/libraries/m5core2_0_1_7
  Not used: /home/builder/opt/libraries/m5stickc_0_2_9
  Not used: /home/builder/opt/libraries/m5stickcplus_0_1_0
  Not used: /home/builder/opt/libraries/m5station_0_0_1
Error during build: exit status 1

The error is certainly a problem. This is the part of the compilation output you need to pay attention to:

The clue is the part where it says "error".

The problem appears to be that the version of the "I2Cdev" library you are using is not compatible with the UNO R4 WiFi board you are compiling for. The reason you got different results with Arduino IDE is that, even though you are using the exact same libraries in Arduino Cloud, you are compiling for a different board than you were in Arduino IDE. If you compiled the sketch in Arduino IDE for the UNO R4 WiFi board you would get the same error.

I installed the latest version of the "MPU6050" and "I2Cdev" libraries and they compile fine for the UNO R4 WiFi. I don't have a MPU6050 on hand so I can't check whether it actually works or not though.

So my recommendation is for you to install the latest version of the libraries. I'll provide instructions you can follow to do that:

Obtain the Latest Version of the Libraries

  1. Click the link below to open the "I2C Device Library" repository in your web browser:
    https://github.com/jrowberg/i2cdevlib
  2. Click the "<> Code ▾" button you see on that page.
    A menu will open.
  3. Select Download ZIP from the menu.
    A download of the ZIP file of the library will start.
  4. Wait for the download to finish.
  5. Unzip the downloaded i2cdevlib-master.zip file.
    The file will be unzipped to a folder named i2cdevlib-master.

Import MPU6050 Library

  1. Click the link below to download a library.properties metadata file I have prepared for the "MPU6050" library:
    library.properties (314 Bytes)
  2. Wait for the download to finish.
  3. Using the Windows "File Explorer", move the downloaded library.properties file to the Arduino\MPU6050\ subfolder of the i2cdevlib-master folder you unzipped at step (5) of the "Obtain the Latest Version of the Libraries" instructions above.
  4. Right click on the MPU6050 folder.
    A context menu will open.
  5. Select "Show more options" from the context menu.
    More options will be shown in the context menu.
  6. Select "Send to > Compressed (zipped) folder" from the context menu.
    A file named MPU6050.zip will be created.
  7. Click the link below to open "Arduino Web Editor" in your web browser:
    https://create.arduino.cc/editor
  8. Select "Libraries" from the menu on the left side of the "Arduino Web Editor" window to open the Libraries panel.
  9. Click the upward pointing arrow button ("Import") to the right side of the "Library Manager" button.
  10. If you get a popup about importing your sketchbook, click the "Import" button.
    A dialog will open that allows you to select a file on your computer to import to your Arduino Cloud account.
  11. Select the MPU6050.zip file that was created at step (6) of these instructions.
  12. Click the "Open" button.
  13. An "Updating library" dialog will open, asking for confirmation of replacing the version of the library you imported earlier today. Click the "OK" button.
  14. Wait for Arduino Web Editor to display the notification that the library was successfully imported.
  15. Click the "OK" button.

Import I2Cdev Library

The "MPU6050" library has a dependency on another library named "I2Cdev". You must also import that library to Arduino Cloud by following these instructions:

  1. Click the link below to download a library.properties metadata file I have prepared for the "I2Cdev" library:
    library.properties (305 Bytes)
  2. Wait for the download to finish.
  3. Using the Windows "File Explorer", move the downloaded library.properties file to the Arduino\I2Cdev\ subfolder of the i2cdevlib-master folder you unzipped at step (5) of the "Obtain the Latest Version of the Libraries" instructions above.
  4. Right click on the I2Cdev folder.
    A context menu will open.
  5. Select "Show more options" from the context menu.
    More options will be shown in the context menu.
  6. Select "Send to > Compressed (zipped) folder" from the context menu.
    A file named I2Cdev.zip will be created.
  7. Click the link below to open "Arduino Web Editor" in your web browser:
    https://create.arduino.cc/editor
  8. Select "Libraries" from the menu on the left side of the "Arduino Web Editor" window to open the Libraries panel.
  9. Click the upward pointing arrow button ("Import") to the right side of the "Library Manager" button.
  10. If you get a popup about importing your sketchbook, click the "Import" button.
    A dialog will open that allows you to select a file on your computer to import to your Arduino Cloud account.
  11. Select the I2Cdev.zip file that was created at step (6) of these instructions.
  12. Click the "Open" button.
  13. An "Updating library" dialog will open, asking for confirmation of replacing the version of the library you imported earlier today. Click the "OK" button.
  14. Wait for Arduino Web Editor to display the notification that the library was successfully imported.
  15. Click the "OK" button.

After completing the instructions above, you should be able to compile your Arduino IoT Cloud Thing sketch without getting the error you encountered before.


Please let me know if you have any questions or problems while following those instructions.

2 Likes

Sorry for late feedback, I had to sleep.

That worked! Completely, no error!

You're amazing! I'm dazzled by how much you know. Thanks so much!

You are welcome. I'm glad it is working now.

Regards,
Per

1 Like

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