Mpu6050

am using mpu6050 and arduino to calculate the speed and acceeration .can some one help me to calculate the speed?

#include <Mpu6050.h>

// Global variables
Mpu6050 sensor;
Mpu6050Data data;
int v;

void setup() 
{
  Serial.begin(9600);

  // Add sensor and then initialize it
  sensor = Mpu6050();

  if (sensor.init())
  {
    Serial.println("Mpu6050 Connected!");
  }
  else
  {
    Serial.println("Failed to connect to Mpu6050.");
  }
}

void loop()
{
  // Collect the current sensor measurements
  data = sensor.readData();

  // 
  Serial.println("---------------------------------------");
  Serial.print("Acceleration (m/s^2): X="); Serial.print(data.acceleration.x); Serial.print(" Y="); Serial.print(data.acceleration.y); Serial.print(" Z="); Serial.println(data.acceleration.z);
  Serial.print("Gyroscope (°/s): X="); Serial.print(data.gyroscope.x); Serial.print(" Y="); Serial.print(data.gyroscope.y); Serial.print(" Z="); Serial.println(data.gyroscope.z);
  Serial.print("Temperature (°C): "); Serial.println(data.temperature);
  v = data.acceleration.x * 9.81 ;
  Serial.print("v= "); 

  delay(1000);
}

Hi,
Welcome to the forum.

Have you googled;
mpu6050 arduino calculate speed acceleration

I have given you a Karma for using code tags.

Thanks.. Tom... :slight_smile: