     Serial.print (mz,DEC);//(mz-700,DEC);  
   
   }
-  
+
+void getInByte() {
+  char inByte = Serial.read();
+  if ( !cmdPending ) {
+    if ( inByte == '\r' || inByte == '\n' ) {
+      cmdPending = true;
+    } else {
+      cmdStr += inByte;
+    }
+  }
+}
    
 
 

// Main loop, read and display data
void loop()
{
  while (!intFlag);
  intFlag=false;
  
  // Display time
  //Serial.print (millis()-ti,DEC);

  accelerometer_subr();
  Serial.print( "," );
  subr_magnetometer();
  Serial.print( "," );
  gyro_subr();
  Serial.println( "" );
  
  // _______________
  // ::: Counter :::
  
  // Display data counter
//  Serial.print (cpt++,DEC);
//  Serial.print ("\t");
  
  // End of line
  //Serial.println("");
  //delay(500);  
 
  // ____________________________________
  // :::  accelerometer and gyroscope ::: 
}
  

  void accelerometer_subr()
  {

  I2CwriteByte(MAG_ADDRESS,0x0A,0x16);
  
   pinMode(13, OUTPUT);
  //Timer1.initialize(1000000);         // initialize timer1, and set a 1/2 second period
  //Timer1.attachInterrupt(callback);  // attaches callback() as a timer overflow interrupt

  cmdPending = false;
  
  // Store initial time
  ti=millis();
}


// Counter
