@OP
1. Let us first correct the sketch that you have posted; because, it is not compiled due to the attachment of wrong methods/functions with the object. The correct names of the methods/functions could be known from the contents of the MPU6050 class declaration of the MPU6050.h library.
class MPU6050
{
public:
bool begin(mpu6050_dps_t scale = MPU6050_SCALE_2000DPS, mpu6050_range_t range = MPU6050_RANGE_2G, int mpua = MPU6050_ADDRESS);
void setClockSource(mpu6050_clockSource_t source);
void setScale(mpu6050_dps_t scale);
void setRange(mpu6050_range_t range);
mpu6050_clockSource_t getClockSource(void);
mpu6050_dps_t getScale(void);
mpu6050_range_t getRange(void);
void setDHPFMode(mpu6050_dhpf_t dhpf);
void setDLPFMode(mpu6050_dlpf_t dlpf);
mpu6050_onDelay_t getAccelPowerOnDelay();
void setAccelPowerOnDelay(mpu6050_onDelay_t delay);
uint8_t getIntStatus(void);
bool getIntZeroMotionEnabled(void);
void setIntZeroMotionEnabled(bool state);
bool getIntMotionEnabled(void);
void setIntMotionEnabled(bool state);
bool getIntFreeFallEnabled(void);
void setIntFreeFallEnabled(bool state);
uint8_t getMotionDetectionThreshold(void);
void setMotionDetectionThreshold(uint8_t threshold);
uint8_t getMotionDetectionDuration(void);
void setMotionDetectionDuration(uint8_t duration);
uint8_t getZeroMotionDetectionThreshold(void);
void setZeroMotionDetectionThreshold(uint8_t threshold);
uint8_t getZeroMotionDetectionDuration(void);
void setZeroMotionDetectionDuration(uint8_t duration);
uint8_t getFreeFallDetectionThreshold(void);
void setFreeFallDetectionThreshold(uint8_t threshold);
uint8_t getFreeFallDetectionDuration(void);
void setFreeFallDetectionDuration(uint8_t duration);
bool getSleepEnabled(void);
void setSleepEnabled(bool state);
bool getI2CMasterModeEnabled(void);
void setI2CMasterModeEnabled(bool state);
bool getI2CBypassEnabled(void);
void setI2CBypassEnabled(bool state);
float readTemperature(void);
Activites readActivites(void);
int16_t getGyroOffsetX(void);
void setGyroOffsetX(int16_t offset);
int16_t getGyroOffsetY(void);
void setGyroOffsetY(int16_t offset);
int16_t getGyroOffsetZ(void);
void setGyroOffsetZ(int16_t offset);
int16_t getAccelOffsetX(void);
void setAccelOffsetX(int16_t offset);
int16_t getAccelOffsetY(void);
void setAccelOffsetY(int16_t offset);
int16_t getAccelOffsetZ(void);
void setAccelOffsetZ(int16_t offset);
void calibrateGyro(uint8_t samples = 50);
void setThreshold(uint8_t multiple = 1);
uint8_t getThreshold(void);
Vector readRawGyro(void);
Vector readNormalizeGyro(void);
Vector readRawAccel(void);
Vector readNormalizeAccel(void);
Vector readScaledAccel(void);
private:
Vector ra, rg; // Raw vectors
Vector na, ng; // Normalized vectors
Vector tg, dg; // Threshold and Delta for Gyro
Vector th; // Threshold
Activites a; // Activities
float dpsPerDigit, rangePerDigit;
float actualThreshold;
bool useCalibrate;
int mpuAddress;
uint8_t fastRegister8(uint8_t reg);
uint8_t readRegister8(uint8_t reg);
void writeRegister8(uint8_t reg, uint8_t value);
int16_t readRegister16(uint8_t reg);
void writeRegister16(uint8_t reg, int16_t value);
bool readRegisterBit(uint8_t reg, uint8_t pos);
void writeRegisterBit(uint8_t reg, uint8_t pos, bool state);
};
2. There is no method such as intialize() in the member functions of MPU6050 class; so, the following line should be removed from the given sketch.
accelgyro.initialize();
3. Now, we have the following corrected version of your sketch which gets compiled.
#include <MPU6050.h>
#include <Wire.h>
MPU6050 accelgyro;
int16_t ax, ay, az, gx, gy, gz;
float accelAngle;
void setup()
{
Wire.begin();
Serial.begin(9600);
while (!Serial)
{
; // wait for serial port to connect. Needed for native USB.
}
// accelgyro.initialize(); //initialize MPU-6050
accelgyro.setAccelOffsetX(-1784);//setXAccelOffset(-1784);
accelgyro.setAccelOffsetY(88);//setYAccelOffset(88);
accelgyro.setAccelOffsetZ(951);//setZAccelOffset(951);
accelgyro.setGyroOffsetX(106);//setXGyroOffset(106);
accelgyro.setGyroOffsetY(-32);//setYGyroOffset(-32);
accelgyro.setGyroOffsetZ(-6);//setZGyroOffset(-6);
}
void loop()
{
}
4. class Keyword
In C++ Programming. the word class itself is a keyword which allows to create a conglomerate type 'data structure' that contains both 'functions/methods and data/variables' along with 'some protection rules'. In Step-1, we have the following declaration; where, we see the use of the 'class' keyword.
class MPU6050
{
//member items; declarations are seen in Step-1
};
5. className -- MPU6050
In Step-4, we have created a class named MPU6050 using the 'class' keyword. MPU6050 is a user-given name, and it refers (encompasses) to all the 'features and characteristics (data types)' of the member items that are present withing the { } pair that follow the className. MPU6050 may be compared with the tag of struct.
6. object -- accelgyro
We create object (s) from className. For example --
MPU6050 accelgyro;
Here, accelgyro is the name of an object on which we can apply all the functions/methods under public: access specifier of the class named MPU6050.
There are good examples on the net on constructor on which you may spend times and then come back to Forum with your queries.