   Serial.println(F(""));
 }
 
-int scnt = 0;
-Measure ms;
 void loop()
 {
-  piSerial.println("\"A\"");
   read_json();
-  ms += read_data();
-  scnt++;
-  if(scnt == N_SAMPLE)
-  {
-    scnt = 0;
-    ms *= 1.0 / N_SAMPLE;
-    /* print_json(ms); */
-    ms = Measure();
-    delay(1000);
-  }
-}
+  set_motor();
+  Measure ms = read_data();
+  print_json(ms);
+  ms = Measure();
+  /* delay(1000); */
+}

  root["pressure"].set(meas.pressure, 0);

  root.printTo(piSerial);
  /* piSerial.print(micros()); */
  piSerial.println("");
}

void print_data(Measure &meas)
{

  Serial.print(F("Time : "));
  Serial.print(micros());
  Serial.println(F(""));

  Serial.print(F("accel : "));

#include "HMC5883L.h"
#include "BMP085.h"
#include "ArduinoJson.h"
#include "Servo.h"

MPU6050 mpu6050;
HMC5883L hmc5883l;
BMP085 bmp085;
Measure meas;
Servo servo[4];
const int SERVO_PIN[4] = {9, 10, 11, 12};
int64_t lastMicros = 0;
double global_time_offset = 0;
/* SoftwareSerial piSerial(10, 11); */
#define piSerial Serial
char indata[256];
int motor[4];
int pos;

void setup() {
  // put your setup code here, to run once:
