Hi, am trying to run the MPU6050 with an ESP32 and have found the code and downloaded all the libraries. However, the code doesn’t compile when I change board from Arduino to ESP32 . Error posted in full below.
Arduino: 1.8.10 (Windows 10), Board: "DOIT ESP32 DEVKIT V1, 80MHz, 921600, None" C:\Users\61426\Documents\Arduino\libraries\I2Cdev\I2Cdev.cpp: In static member function 'static int8_t I2Cdev::readBytes(uint8_t, uint8_t, uint8_t, uint8_t*, uint16_t)': C:\Users\61426\Documents\Arduino\libraries\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)) { ^ C:\Users\61426\Documents\Arduino\libraries\I2Cdev\I2Cdev.cpp: In static member function 'static int8_t I2Cdev::readWords(uint8_t, uint8_t, uint8_t, uint16_t*, uint16_t)': C:\Users\61426\Documents\Arduino\libraries\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)) { ^ Multiple libraries were found for "I2Cdev.h" Used: C:\Users\61426\Documents\Arduino\libraries\I2Cdev Multiple libraries were found for "Wire.h" Used: C:\Users\61426\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\Wire Multiple libraries were found for "MPU6050.h" Used: C:\Users\61426\Documents\Arduino\libraries\MPU6050 exit status 1 Error compiling for board DOIT ESP32 DEVKIT V1. This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.
The code and setup used is from this website here :
- dronebotworkshop.com/mpu-6050-level/
I used one of the examples (the second one) . Any help would be greatly appreciated.
Hi.
How did you install your libraries?
The MPU6050.h library should be installed on this path like the wire library:
C:\Users\61426\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries
Additionally, it seems that there is an error in the I2Cdev.cpp file from the I2Cdev library.
Maybe you should start by trying the MPU6050 examples provided in the library:https://github.com/ElectronicCats/mpu6050 and see if they work and then proceed with your project.
Regards,
Sara
Hi, I installed it using sketch->include library-> add .zip library. Can you link me a way to add it to that particular path?
Hi.
You should unzip the library and copy the library folder to this path:
C:\Users\61426\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries
I think it works with Arduino because the library is in the arduino folder, but it is not in the ESP32 libraries folder.
Regards,
Sara