AVR-Playground/MPU6050.h

27 lines
715 B
C
Raw Normal View History

2024-03-23 22:19:48 +01:00
#pragma once
2024-03-24 01:23:44 +01:00
// I2c address of MPU6050
2024-03-25 11:12:02 +01:00
#define MPU6050_ADDR 0x68 // With AD0 pin grounded/floating, otherwise 0x69
2024-03-24 01:23:44 +01:00
// MPU-6050 register addresses
2024-03-27 10:11:20 +01:00
#define MPU6050_REG_ACCEL_XOUT_H 0x3B
#define MPU6050_REG_ACCEL_XOUT_L 0x3C
#define MPU6050_REG_GYRO_XOUT_H 0x43
#define MPU6050_REG_GYRO_XOUT_L 0x44
#define MPU6050_TEMP_OUT_H 0x41
#define MPU6050_TEMP_OUT_L 0x42
#define MPU6050_REG_PWR_MGMT_1 0x6B
2024-03-24 01:23:44 +01:00
#include <avr/io.h>
2024-03-25 11:12:02 +01:00
#include <stdint.h>
2024-03-24 01:23:44 +01:00
#include <util/delay.h>
// Function to initialize MPU-6050
void MPU6050_Init();
// Function to read accelerometer data from MPU-6050
2024-03-25 11:12:02 +01:00
void MPU6050_Read_Accel(int16_t *accel_data);
2024-03-24 01:23:44 +01:00
// Function to read gyroscope data from MPU-6050
2024-03-25 11:12:02 +01:00
void MPU6050_Read_Gyro(int16_t *gyro_data);