Serial read data from labview to another arduino wirelessly

Hi, thank you for your insight. Do you have any available code for this or any example that can lead me to apply this? I still don't know how to use 3 MPU6050 in 1 arduino to get the Pitch, Roll, and Yaw angle. I am also using the arduino library <MPU6050_light.h>. I tried to connect two MPU6050 and run this program, but I'm only getting the MPU1 output.

#include<Wire.h>
#include <MPU6050_light.h>
MPU6050 mpu(Wire);

unsigned long timer = 0;

const int MPU2=0x69,MPU1=0x68;
int16_t P1, R1, Y1;
int16_t P2, R2, Y2;

 
//-------------------------------------------------\setup loop\------------------------------------------------------------ 
 void setup(){ 
      Wire.begin(); 
      Wire.beginTransmission(MPU1);
      Wire.write(0x6B);// PWR_MGMT_1 register 
      Wire.write(0); // set to zero (wakes up the MPU-6050)
      Wire.endTransmission(true);Wire.begin(); 
      Wire.beginTransmission(MPU2);
      Wire.write(0x6B);// PWR_MGMT_1 register 
      Wire.write(0); // set to zero (wakes up the MPU-6050)
      Wire.endTransmission(true);
      Serial.begin(9600); 
      
      byte status = mpu.begin();
      mpu.calcOffsets(); // gyro and accelero
     } 
     
//---------------------------------------------------\void loop\------------------------------------------------------------
 void loop(){
   mpu.update();
      //get values for first mpu having address of 0x68   
      
      GetMpuValue1(MPU1);
      
  
      //get values for second mpu having address of 0x69
      GetMpuValue2(MPU2);
   
    }
 
//----------------------------------------------\user defined functions\-------------------------------------------------- 
      
 
 void GetMpuValue1(const int MPU){ 
   
      Wire.beginTransmission(MPU); 
      Wire.write(0x3B); // starting with register 0x3B (ACCEL_XOUT_H) 
      Wire.endTransmission(false);
      Wire.requestFrom(MPU, 14, true); // request a total of 14 registers 
           if((millis()-timer)>10){ // print data every 10m  
  	  P1= mpu.getAngleY()*-1 ;
      R1= mpu.getAngleX();
      Y1= mpu.getAngleZ();

      Serial.print("IMU 1  ");
      Serial.print(P1);  // print pitch angle
      Serial.print(",");
      Serial.print(R1); //print roll angle
      Serial.print(",");
	    Serial.println(Y1);  //print yaw angle
	    timer = millis();  
    
      

     }
    
 }
     
     
 void GetMpuValue2(const int MPU){ 
   
      Wire.beginTransmission(MPU); 
      Wire.write(0x3B); // starting with register 0x3B (ACCEL_XOUT_H) 
      Wire.endTransmission(false);
      Wire.requestFrom(MPU, 14, true); // request a total of 14 registers 
         
      if((millis()-timer)>10){ // print data every 10m  
  	  P2= mpu.getAngleY()*-1 ;
      R2= mpu.getAngleX();
      Y2= mpu.getAngleZ();

      Serial.print("IMU 2  ");
      Serial.print(P2);  // print pitch angle
      Serial.print(",");
      Serial.print(R2); //print roll angle
      Serial.print(",");
	    Serial.println(Y2);  //print yaw angle
	    timer = millis();  
      Serial.println("");

     }
 }

Why do you need to use 3 mpu6050? Will you explain your project more

@angge097 ,

You appear to have created another account, which I have suspended. You are allowed one forum account. If you continue to create more accounts you risk permanent suspension from the forum.

Thank you

1 Like

I have noticed that for new user there is a reply limitation.
How that works?
I mean is there only reply limitation only for first day or something else

New users start at trust level 0, with sever limitations on what they can post. They then progress to TL1, and eventually to TL2, which is what most regular users are at. For more information see: Understanding Discourse Trust Levels

Are you still working on this project?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.