Hi everyone,
I'm new to Arduino and I'm currently working on a project that involves using an MPU6050 accelerometer and a BMP085 barometric pressure sensor. However, I've run into some errors in my code that I can't seem to fix on my own.
Here is the code that I'm working with:
#include <Wire.h>
#include <I2Cdev.h>
#include <MPU6050.h>
#include <Adafruit_BMP085.h>MPU6050 mpu;
Adafruit_BMP085 bmp;void setup() {
Wire.begin();
Serial.begin(9600);
mpu.initialize();
if (mpu.dmpInitialize() != 0) {
Serial.println("MPU6050 initialization failed");
while (1);
}
bmp.begin();
}void loop() {
float pressure = bmp.getPressure() / 100.0F;
Serial.print("Pressure: ");
Serial.print(pressure);
Serial.print(" hPa");VectorInt16 rawAccel = mpu.getAccelerationRaw(); VectorFloat normAccel = mpu.getAcceleration(); Serial.print("Accel X: "); Serial.print(rawAccel.x); Serial.print(", Y: "); Serial.print(rawAccel.y); Serial.print(", Z: "); Serial.print(rawAccel.z); Serial.print(", Normalized: "); Serial.print(normAccel.x); Serial.print(", "); Serial.print(normAccel.y); Serial.print(", "); Serial.println(normAccel.z); VectorInt16 rawGyro = mpu.getRotationRaw(); VectorFloat normGyro = mpu.getRotation(); Serial.print("Gyro X: "); Serial.print(rawGyro.x); Serial.print(", Y: "); Serial.print(rawGyro.y); Serial.print(", Z: "); Serial.print(rawGyro.z); Serial.print(", Normalized: "); Serial.print(normGyro.x); Serial.print(", "); Serial.print(normGyro.y); Serial.print(", "); Serial.println(normGyro.z); delay(500);}
And here is the error message that I'm getting:
In function 'void setup()':
error: 'class MPU6050' has no member named 'dmpInitialize'; did you mean 'initialize'?In function 'void loop()':
error: no matching function for call to 'Adafruit_BMP085_Unified::getPressure()'
error: 'VectorInt16' was not declared in this scope
error: 'VectorFloat' was not declared in this scope
error: expected ';' before 'rawGyro'
error: expected ';' before 'normGyro'
I would really appreciate any suggestions or insights that you might have on how to fix these errors. Thank you in advance for your help!