I'm trying to use a mpu6050 sensor alongside a gpy-gpsmv2 and an arduino nano clone but I can't get the mpu6050 to give any output while the gps module works fine.
I'm using two different codes for each module just for testing before coding both in the same.
Any help is welcomed.
Hardware configuration:
9V battery connected to VIN and GND in the nano.
MPU6050:
VCC --> 5V
GND --> GND
SCL --> A5
SDA --> A4
GY-GPS6MV2:
VCC --> 3.3V
RX --> D3
TX --> D4
GND --> GND
MPU6050 code:
#include "I2Cdev.h"
#include "MPU6050.h"
#include "Wire.h"
MPU6050 sensor;
int ax, ay, az;
int gx, gy, gz;
void setup() {
Serial.begin(57600); //Iniciando puerto serial
Wire.begin(); //Iniciando I2C
sensor.initialize(); //Iniciando el sensor
if (sensor.testConnection()) Serial.println("Sensor iniciado correctamente");
else Serial.println("Error al iniciar el sensor");
}
void loop() {
sensor.getAcceleration(&ax, &ay, &az);
sensor.getRotation(&gx, &gy, &gz);
Serial.print("a[x y z] g[x y z]:\t");
Serial.print(ax); Serial.print("\t");
Serial.print(ay); Serial.print("\t");
Serial.print(az); Serial.print("\t");
Serial.print(gx); Serial.print("\t");
Serial.print(gy); Serial.print("\t");
Serial.println(gz);
delay(100);
}
