DEBUG printing, comments
This commit is contained in:
parent
78e3ddce19
commit
c43fae4e45
1 changed files with 11 additions and 2 deletions
13
MPU6050.c
13
MPU6050.c
|
@ -3,14 +3,23 @@
|
||||||
#include <util/delay.h>
|
#include <util/delay.h>
|
||||||
#include "MPU6050.h"
|
#include "MPU6050.h"
|
||||||
#include "i2c.h"
|
#include "i2c.h"
|
||||||
|
#include "uart.h"
|
||||||
|
|
||||||
// Function to initialize MPU-6050
|
// Function to initialize MPU-6050
|
||||||
void MPU6050_Init() {
|
void MPU6050_Init() {
|
||||||
|
DEBUG("Initializing MPU6050...");
|
||||||
// Wake up MPU-6050 by writing to PWR_MGMT_1 register
|
// Wake up MPU-6050 by writing to PWR_MGMT_1 register
|
||||||
I2C_start(MPU6050_ADDR << 1 | TW_WRITE);
|
I2C_start(MPU6050_ADDR << 1 | TW_WRITE);
|
||||||
I2C_write(MPU6050_REG_PWR_MGMT_1);
|
|
||||||
I2C_write(0x00); // Clear sleep mode bit
|
// These two seem to be causing problems
|
||||||
|
// DEBUG("Sending PWR_MGMT_1 register address");
|
||||||
|
// I2C_write(MPU6050_REG_PWR_MGMT_1);
|
||||||
|
// DEBUG("Writing 0x00 to PWR_MGMT_1 register");
|
||||||
|
// I2C_write(0x00); // Clear sleep mode bit
|
||||||
|
|
||||||
|
DEBUG("Stopping I2C communication");
|
||||||
I2C_stop();
|
I2C_stop();
|
||||||
|
DEBUG("MPU6050 Initialized!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to read accelerometer data from MPU-6050
|
// Function to read accelerometer data from MPU-6050
|
||||||
|
|
Loading…
Reference in a new issue