Jump to content
I2Cdevlib Forums

MPU6050 get zero results after sometimes


Recommended Posts

Hi,

 

I have a very weird condition now. I am currently using Sparkfun MPU6050 and I had modified Jeff code so that I can store the result in excel file (through PLX-DAQ).

 

Below is my modified code:

 

 

 

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include "I2Cdev.h"
#include "MPU6050.h"
 
 
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
    #include "Wire.h"
#endif
 
 
MPU6050 accelgyro;
 
 
int16_t ax, ay, az;
int16_t gx, gy, gz;
 
 
 
 
#define OUTPUT_READABLE_ACCELGYRO
 
 
//#define OUTPUT_BINARY_ACCELGYRO
 
 
 
unsigned long time;
void setup() {
    // join I2C bus (I2Cdev library doesn't do this automatically)
     #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
        Wire.begin();
    #elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
        Fastwire::setup(400, true);
    #endif
        
   
 
   
    Serial.println("CLEARDATA");
    Serial.println("LABEL,Time,time,ax,ay,az,gx,gy,gz");
    
   
   
   
}
 
void loop() 
{
  
  time=millis();
    // read raw accel/gyro measurements from device
    accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
 
   
        Serial.print("DATA,TIME,");
        Serial.print(time);
        Serial.print(",");
        Serial.print(ax); Serial.print(",");
        Serial.print(ay); Serial.print(",");
        Serial.print(az); Serial.print(",");
        Serial.print(gx); Serial.print(",");
        Serial.print(gy); Serial.print(",");
        Serial.println(gz);
    
 
delay(10);
}
 
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
However, the results become all zero after some time of using MPU6050. I need to re-upload the original Jeff unmodified code again, then only upload my modified code. This will goes on and on and I need to figure out why?????
 
 
HELP ME!!!
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...