    Serial.println("Testing device connections...");
    Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");
 
+   ms5611.setOversampling(MS5611_ULTRA_HIGH_RES);
    ms5611.begin();
 
    // configure Arduino LED for
    pinMode(LED_PIN, OUTPUT);
+   ds.header=0xa5a5;
 }
+
 
 void loop() {
    
-   accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
-   mag.getHeading(&mx, &my, &mz);
+   accelgyro.getMotion6(&ds.ax, &ds.ay, &ds.az, &ds.gx, &ds.gy, &ds.gz);
+   mag.getHeading(&ds.mx, &ds.my, &ds.mz);
      // Read raw values
-   uint32_t rawTemp = ms5611.readRawTemperature();
-   uint32_t rawPressure = ms5611.readRawPressure();
+   //uint32_t rawTemp = ms5611.readRawTemperature();
+   //uint32_t rawPressure = ms5611.readRawPressure();
 
    // Read true temperature & Pressure
-   double realTemperature = ms5611.readTemperature();
-   long realPressure = ms5611.readPressure();
+   //double realTemperature = ms5611.readTemperature();
+   int32_t realPressure = ms5611.readPressure();
 
    // Calculate altitude
-   float absoluteAltitude = ms5611.getAltitude(realPressure);
+   ds.absoluteAltitude = ms5611.getAltitude(realPressure);
    //float relativeAltitude = ms5611.getAltitude(realPressure, referencePressure);
 
 
    // display tab-separated accel/gyro x/y/z values
+#if 0
    Serial.print("a/g:\t");
    Serial.print(ax); Serial.print("\t");
    Serial.print(ay); Serial.print("\t");


   Serial.print("alt:\t");
   Serial.println( absoluteAltitude );
   // blink LED to indicate activity
   blinkState = !blinkState;
   digitalWrite(LED_PIN, blinkState);
}

MS5611 ms5611;


uint32_t time;

MPU6050 accelgyro;
HMC5883L mag;


typedef struct {
  uint16_t header;
  int16_t ax, ay, az;
  int16_t gx, gy, gz;
  int16_t mx, my, mz;
  float absoluteAltitude;
  uint32_t t_stemp;
  uint16_t footer; 
} data_struct;

data_struct ds;

void chksum()
{
  uint16_t sum=0;
  ds.t_stemp=millis();
  for(int i=1;i<(sizeof(ds)/2-2);i++)
  {
    uint16_t* pds=(uint16_t*)&ds;
    sum+=pds[i];
  }
  ds.footer=sum;
}

#define LED_PIN 13
bool blinkState = false;
int iters=0;

void setup() {
  
