PlatformIO Community

PIO provided libs (i2cdev + MPU6050) + example + adafruit feather nrf52840: Class members not found

Hi,

I’m trying to run the example found here:

Here is my platformio.ini:

[env:adafruit_feather_nrf52832]
platform = nordicnrf52
board = adafruit_feather_nrf52832
framework = arduino
monitor_speed = 38400
lib_deps = 
    jrowberg/I2Cdevlib-Core
    jrowberg/I2Cdevlib-MPU6050
    adafruit/Adafruit TinyUSB Library@^1.10.1

In src I have the exact same file IMU_Zero.ino as in the pio registry link above, renamed to IMU_Zero.cpp

A dry run build throws these no member named errors:

src/main.cpp: In function 'void Initialize()':
src/main.cpp:184:19: error: 'class MPU6050' has no member named 'CalibrateAccel'
         accelgyro.CalibrateAccel(6);
                   ^~~~~~~~~~~~~~
src/main.cpp:185:19: error: 'class MPU6050' has no member named 'CalibrateGyro'
         accelgyro.CalibrateGyro(6);
                   ^~~~~~~~~~~~~
src/main.cpp:187:19: error: 'class MPU6050' has no member named 'PrintActiveOffsets'
         accelgyro.PrintActiveOffsets();

[…]
(there’s more).

Checking the jrowberg i2cdevlib repository, I see the members can be found here:

I thought the library version on the platformio registry was not the latest so I tried to add the following to the lib_deps section of my platformio.ini, in order to replace the ones currently in the registry. The updated platformio.ini was:

[env:adafruit_feather_nrf52832]
platform = nordicnrf52
board = adafruit_feather_nrf52832
framework = arduino
monitor_speed = 38400
lib_deps = 
    https://github.com/jrowberg/i2cdevlib.git
    adafruit/Adafruit TinyUSB Library@^1.10.1

But this didn’t change anything, the error remained the same.

Note: the MPU6050_raw.ino found at PlatformIO Registry builds and uploads fine.

Is it an issue with not using the latest library version or should I dig into the latest i2cdev repo MPU6050.cpp and include the defined members in the IMU_Zero.cpp example code (could work but unlikely to be a convenient solution)?

Thanks, Ludo

Here is what I eventually did to get it to build and upload.
Download the MPU6050 and i2cdev folders from i2cdevlib/Arduino at master · jrowberg/i2cdevlib · GitHub and put these in the lib directory of my project.
I did:

svn checkout https://github.com/jrowberg/i2cdevlib/trunk/Arduino/I2Cdev
svn checkout https://github.com/jrowberg/i2cdevlib/trunk/Arduino/MPU6050

Get the latest IMU_zero.ino code from the MPU6050 example folder as my source code and it built fine.
Just had to move the SetAveraging function up in the code as it was declared after being first used.