   az_f = az / 16384.0;
 
   // display tab-separated accel/gyro x/y/z values
-   Serial.print("a/g:\t");
-   Serial.print(ax_f); Serial.print("\t");
-   Serial.print(ay_f); Serial.print("\t");
-   Serial.print(az_f); Serial.print("\t");
-   Serial.print(gx); Serial.print("\t");
-   Serial.print(gy); Serial.print("\t");
-   Serial.print(gz);Serial.print("\t");
-   
-   Serial.print("mag:\t");
-   Serial.print(mx); Serial.print("\t");
-   Serial.print(my); Serial.print("\t");
-   Serial.print(mz); Serial.print("\t");
+  Serial.print("a/g:\t");
+  Serial.print(ax_f); Serial.print("\t");
+  Serial.print(ay_f); Serial.print("\t");
+  Serial.print(az_f); Serial.print("\t");
+  Serial.print(gx); Serial.print("\t");
+  Serial.print(gy); Serial.print("\t");
+  Serial.print(gz); Serial.print("\t");
+
+  Serial.print("mag:\t");
+  Serial.print(mx); Serial.print("\t");
+  Serial.print(my); Serial.print("\t");
+  Serial.print(mz); Serial.print("\t");
 
   // To calculate heading in degrees. 0 degree indicates North
-   float heading = atan2(my, mz);
-   if(heading < 0)
-     heading += 2 * M_PI;
-   heading *= 180/M_PI;
-   Serial.print("heading:\t");
-   Serial.print(heading); Serial.print("\t");
-
-   // display measured values if appropriate
-   Serial.print("T/P/A\t");
-   Serial.print(temperature); Serial.print("\t");
-   Serial.print(pressure); Serial.print("\t");
-   Serial.print(altitude);
-   Serial.println("");
-
-  dtostrf(ax_f, 4, 2, tempbuffer[0]);   // -x.x
-  dtostrf(ay_f, 4, 2, tempbuffer[1]);   // -x.x
-  dtostrf(az_f, 4, 2, tempbuffer[2]);   // -x.x
+  float heading = atan2(my, mz);
+  if (heading < 0)
+    heading += 2 * M_PI;
+  heading *= 180 / M_PI;
+  Serial.print("heading:\t");
+  Serial.print(heading); Serial.print("\t");
+
+  // display measured values if appropriate
+  Serial.print("T/P/A\t");
+  Serial.print(temperature); Serial.print("\t");
+  Serial.print(pressure); Serial.print("\t");
+  Serial.print(altitude);
+  Serial.println("");
+
+  dtostrf_sign(ax_f, 4, 2, tempbuffer[0]);   // -x.x
+  dtostrf_sign(ay_f, 4, 2, tempbuffer[1]);   // -x.x
+  dtostrf_sign(az_f, 4, 2, tempbuffer[2]);   // -x.x
   snprintf(displaybuffer[0], 21, "A %s %s %s", tempbuffer[0], tempbuffer[1], tempbuffer[2]);
-  
+
   snprintf(displaybuffer[1], 21, "G: %+4d %+4d %+4d", gx, gy, gz);
 
   dtostrf(heading, 3, 0, tempbuffer[0]);   // xxx
   snprintf(displaybuffer[2], 21, "H: %s", tempbuffer[0]);
 
-  dtostrf(temperature, 5, 2, tempbuffer[0]);   // -xx.x  
-  dtostrf(pressure, 5, 2, tempbuffer[1]);   // -xx.x  
+  dtostrf(temperature, 5, 2, tempbuffer[0]);   // -xx.x
+  dtostrf(pressure, 5, 2, tempbuffer[1]);   // -xx.x
   snprintf(displaybuffer[3], 21, "T: %s, P: %s", tempbuffer[0], tempbuffer[1]);
 
-//   Serial.println(displaybuffer[0]);
-//   Serial.println(displaybuffer[1]);
-//   Serial.println(displaybuffer[2]);
-//   Serial.println(displaybuffer[3]);
+  //   Serial.println(displaybuffer[0]);
+  //   Serial.println(displaybuffer[1]);
+  //   Serial.println(displaybuffer[2]);
+  //   Serial.println(displaybuffer[3]);
 
   display.clearDisplay();
-  display.setCursor(0,0);
+  display.setCursor(0, 0);
   display.println(displaybuffer[0]);
-//  display.println(displaybuffer[1]);
-//  display.println(displaybuffer[2]);
-//  display.println(displaybuffer[3]);
+  //  display.println(displaybuffer[1]);
+  display.println(displaybuffer[2]);
+  //  display.println(displaybuffer[3]);
   delay(10);
   yield();
   display.display();
 
-  delay(100);  
+  delay(100);
 }

BMP085            barometer;
Adafruit_SSD1306  display = Adafruit_SSD1306();

// store accel and gyro values from MPU6050, and accel using unit "g"(float) 
int16_t ax, ay, az;
int16_t gx, gy, gz;
int16_t mx, my, mz;

  Serial.println("... initializing done.");
}


void loop() {
  char displaybuffer[4][21];  // 4 lines with 21 chars each
  char tempbuffer[3][15];     // temp for float to str conversion

  accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
  mag.getHeading(&mx, &my, &mz);

  // request temperature
  barometer.setControl(BMP085_MODE_TEMPERATURE);

  // wait appropriate time for conversion (4.5ms delay)
  lastMicros = micros();
  while (micros() - lastMicros < barometer.getMeasureDelayMicroseconds());
