Open Gugarauj07 opened 2 years ago
Hey, Im trying to use the setAddress() Method but im still only having the data from the 0x68 device. Can somebody help me?
#include <MPU6050_light.h> #include "Wire.h" float currentAngleX_A, currentAngleY_A, currentAngleZ_A; float currentAngleX_B, currentAngleY_B, currentAngleZ_B; MPU6050 mpuA(Wire); MPU6050 mpuB(Wire); void setup() { Serial.begin(9600); Wire.begin(); mpuA.setAddress(0x68); mpuA.begin(); Serial.println(F("Calculating gyro offset, do not move MPU6050")); delay(1000); mpuA.calcGyroOffsets(); Serial.println("Done."); mpuB.setAddress(0x69); mpuB.begin(); Serial.println(F("Calculating gyro offset, do not move MPU6050")); delay(1000); mpuB.calcGyroOffsets(); Serial.println("Done."); } void loop() { mpuA.update(); currentAngleX_A = mpuA.getAngleX(); currentAngleY_A = mpuA.getAngleY(); currentAngleZ_A = mpuA.getAngleZ(); mpuB.update(); currentAngleX_B = mpuB.getAngleX(); currentAngleY_B = mpuB.getAngleY(); currentAngleZ_B = mpuB.getAngleZ(); Serial.print(currentAngleX_A); Serial.print(" , "); Serial.print(currentAngleY_A); Serial.print(" , "); Serial.print(currentAngleZ_A); Serial.print(" , "); Serial.print(currentAngleX_B); Serial.print(" , "); Serial.print(currentAngleY_B); Serial.print(" , "); Serial.print(currentAngleZ_B); Serial.println(" "); }
Hi,
Late response, but I came here because I was figuring out how to connect two sensors. Actually you're code helped me, and it works fine! Did you pull pin AD0 high on one of the sensors?
Hey, Im trying to use the setAddress() Method but im still only having the data from the 0x68 device. Can somebody help me?