ElectronicCats/mpu6050

'class MPU6050' has no member named 'begin'

LawsonDG opened this issue · 2 comments

When I try and compile the code to my Arduino UNO I get the error 'class MPU6050' has no member named 'begin'

Here is my code:

#include <Wire.h>
#include <MPU6050.h>

MPU6050 mpu;
 
void setup()
{
  Serial.begin(115200);
 
  Serial.println("Inicjalizacja MPU6050");
 
  while(!mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G))
  {
    Serial.println("Nie mozna znalezc MPU6050 - sprawdz polaczenie!");
    delay(500);
  }
}
 
void loop()
{
  Vector rawAccel = mpu.readRawAccel();
  Vector normAccel = mpu.readNormalizeAccel();
 
  Serial.print(" Xraw = ");
  Serial.print(rawAccel.XAxis);
  Serial.print(" Yraw = ");
  Serial.print(rawAccel.YAxis);
  Serial.print(" Zraw = ");
 
  Serial.println(rawAccel.ZAxis);
  Serial.print(" Xnorm = ");
  Serial.print(normAccel.XAxis);
  Serial.print(" Ynorm = ");
  Serial.print(normAccel.YAxis);
  Serial.print(" Znorm = ");
  Serial.println(normAccel.ZAxis);
 
  delay(10);
}

Thanks in advance

Where have you taken the example from? Our examples do not include "mpu.begin()", check our examples https://github.com/ElectronicCats/mpu6050/tree/master/examples

You might have this issue when you have several libraries installed that are using the same class name.
Check your MPU6050 librairies and remove the ones that you don't use.
Hope this helps.