I have already prepared the physcal setup of the project but am having a lot of trouble with the code. I don't know how to fix the problem with the library. I have tried it on my desktop as well as web editor, with the same results. Is there something wrong with the library itself or is it the code? I read somewhere that MPU6050 library had keys for both the 6-axis gyroscope and 9-axis gyrosocpe (this project involves 6-axis). I do not know how i can fix this problem. I have put the error and the code below:
You will often find that there are multiple libraries which contain a generic header filename like "MPU6050.h". You need to use the specific version of the library the code was written for. In a perfect world, the author of the code would have taken a few seconds to document where you can find this library. Unfortunately, in this case the author of the code was not so kind. So you will either need to go on a scavenger hunt to find that specific library, or else rewrite the code to work with the library you are using.
I was unable to identify which were the unnecessary file duplicates and hit and trial with multiple of them did not succeed. The link of picture of list of files present and the keywords.txt is: #1List of files in 'MPU6050' in library #2Keywords.txt - Album on Imgur
The full error message is:
Arduino: 1.8.10 (Mac OS X), Board: "Arduino/Genuino Uno"
/Users/dev/Documents/Arduino/earthquake/earthquake.ino: In function 'void setup()':
earthquake:39:14: error: 'class MPU6050' has no member named 'begin'
while(!mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G))
^~~~~
earthquake:39:20: error: 'MPU6050_SCALE_2000DPS' was not declared in this scope
while(!mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G))
^~~~~~~~~~~~~~~~~~~~~
/Users/dev/Documents/Arduino/earthquake/earthquake.ino:39:20: note: suggested alternative: 'MPU6050_RA_FF_DUR'
while(!mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G))
^~~~~~~~~~~~~~~~~~~~~
MPU6050_RA_FF_DUR
earthquake:39:43: error: 'MPU6050_RANGE_2G' was not declared in this scope
while(!mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G))
^~~~~~~~~~~~~~~~
/Users/dev/Documents/Arduino/earthquake/earthquake.ino:39:43: note: suggested alternative: 'MPU6050_RA_FF_DUR'
while(!mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G))
^~~~~~~~~~~~~~~~
MPU6050_RA_FF_DUR
earthquake:45:7: error: 'class MPU6050' has no member named 'setThreshold'
mpu.setThreshold(3);
^~~~~~~~~~~~
/Users/dev/Documents/Arduino/earthquake/earthquake.ino: In function 'void checkSettings()':
earthquake:73:10: error: 'MPU6050_CLOCK_EXTERNAL_19MHZ' was not declared in this scope
case MPU6050_CLOCK_EXTERNAL_19MHZ: Serial.println("PLL with external 19.2MHz reference"); break;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dev/Documents/Arduino/earthquake/earthquake.ino:73:10: note: suggested alternative: 'MPU6050_CLOCK_INTERNAL'
case MPU6050_CLOCK_EXTERNAL_19MHZ: Serial.println("PLL with external 19.2MHz reference"); break;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
MPU6050_CLOCK_INTERNAL
earthquake:75:10: error: 'MPU6050_CLOCK_EXTERNAL_32KHZ' was not declared in this scope
case MPU6050_CLOCK_EXTERNAL_32KHZ: Serial.println("PLL with external 32.768kHz reference"); break;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dev/Documents/Arduino/earthquake/earthquake.ino:75:10: note: suggested alternative: 'MPU6050_CLOCK_INTERNAL'
case MPU6050_CLOCK_EXTERNAL_32KHZ: Serial.println("PLL with external 32.768kHz reference"); break;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
MPU6050_CLOCK_INTERNAL
earthquake:83:10: error: 'MPU6050_CLOCK_INTERNAL_8MHZ' was not declared in this scope
case MPU6050_CLOCK_INTERNAL_8MHZ: Serial.println("Internal 8MHz oscillator"); break;
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dev/Documents/Arduino/earthquake/earthquake.ino:83:10: note: suggested alternative: 'MPU6050_CLOCK_INTERNAL'
case MPU6050_CLOCK_INTERNAL_8MHZ: Serial.println("Internal 8MHz oscillator"); break;
^~~~~~~~~~~~~~~~~~~~~~~~~~~
MPU6050_CLOCK_INTERNAL
earthquake:89:14: error: 'class MPU6050' has no member named 'getScale'; did you mean 'getRate'?
switch(mpu.getScale))
^~~~~~~~
getRate
earthquake:89:23: error: expected primary-expression before ')' token
switch(mpu.getScale))
^
earthquake:101:20: error: 'class MPU6050' has no member named 'getGyroOffsetX'; did you mean 'getXGyroOffset'?
Serial.print(mpu.getGyroOffsetX());
^~~~~~~~~~~~~~
getXGyroOffset
earthquake:105:20: error: 'class MPU6050' has no member named 'getGyroOffsetY'; did you mean 'getXGyroOffset'?
Serial.print(mpu.getGyroOffsetY());
^~~~~~~~~~~~~~
getXGyroOffset
earthquake:109:22: error: 'class MPU6050' has no member named 'getGyroOffsetZ'; did you mean 'getXGyroOffset'?
Serial.println(mpu.getGyroOffsetZ());
^~~~~~~~~~~~~~
getXGyroOffset
/Users/dev/Documents/Arduino/earthquake/earthquake.ino: In function 'void loop()':
earthquake:115:5: error: 'Vector' was not declared in this scope
{ Vector rawGyro = mpu.readRawGyro();
^~~~~~
/Users/dev/Documents/Arduino/earthquake/earthquake.ino:115:5: note: suggested alternative: 'perror'
{ Vector rawGyro = mpu.readRawGyro();
^~~~~~
perror
earthquake:117:10: error: expected ';' before 'normGyro'
Vector normGyro = mpu.readNormalizeGyro();
^~~~~~~~
earthquake:121:16: error: 'rawGyro' was not declared in this scope
Serial.print(rawGyro.XAxis);
^~~~~~~
earthquake:131:4: error: 'normGyro' was not declared in this scope
if(normGyro.XAxis > maxval || normGyro.XAxis < minval && normGyro.YAxis > maxval || normGyro.YAxis < minval && normGyro.ZAxis > maxval || normGyro.ZAxis < minval)
^~~~~~~~
earthquake:159:16: error: 'normGyro' was not declared in this scope
Serial.print(normGyro.XAxis);
^~~~~~~~
Multiple libraries were found for "LiquidCrystal.h"
Used: /Applications/Arduino.app/Contents/Java/libraries/LiquidCrystal
Multiple libraries were found for "Wire.h"
Used: /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/Wire
Multiple libraries were found for "MPU6050.h"
Used: /Users/dev/Documents/Arduino/libraries/MPU6050
exit status 1
'class MPU6050' has no member named 'begin'
Check the box next to "Show verbose output during: compilation" in File > Preferences and compile again. That should cause it to show you the location of the other MPU6050 library that is not being used.
I looked for it in the complete verbose error message but could not find it. It only had this message:
Multiple libraries were found for "LiquidCrystal.h"
Used: /Applications/Arduino.app/Contents/Java/libraries/LiquidCrystal
Multiple libraries were found for "Wire.h"
Used: /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/Wire
Multiple libraries were found for "MPU6050.h"
Used: /Users/dev/Documents/Arduino/libraries/MPU6050
Using library LiquidCrystal at version 1.0.7 in folder: /Applications/Arduino.app/Contents/Java/libraries/LiquidCrystal
Using library Wire at version 1.0 in folder: /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/Wire
Using library MPU6050 at version 0.0.2 in folder: /Users/dev/Documents/Arduino/libraries/MPU6050
exit status 1
'class MPU6050' has no member named 'begin'
I suspected that i had it in both the Java/libraries and the Documents/Libraries, but that was not the case after i cheacked for it.
I tried the same in the web editor and it had this message:
Multiple libraries were found for "MPU6050.h"
Used: /tmp/899662345/pinned/mpu6050_0_0_2
Not used: /home/builder/opt/libraries/latest/mpu6050_0_0_2
Not used: /home/builder/opt/libraries/latest/grove_imu_9dof_1_0_0
But in this case, i do not know where i can find these files and ammend them. Where do i input the location address to find the files and remove them?