 
 char buf [20];
 
-signed int motorSpeed = 0;
-long pos = 0;
-long oldPos = 0;
+int initPos = 0;
+int curPos = 0;
+int stopPos = 0;
+
+long initTime;
+long curTime;
+long nxtTime;
+
 
 
 Encoder myEncoder(ENC1, ENC2);

  Calibrate();
  Serial.println("Done.");
  
  pos = 0;
  
  while(true)
  {
    GoTo(1000);
    delay(500);
    pos = myEncoder.read();
    Serial.println(pos);

    GoTo(8000);
    delay(500);
    pos = myEncoder.read();
    Serial.println(pos);
  }
}

void GoTo(long pos)

#define M1 4 
#define E2 6                      
#define M2 7

#define DATASIZE 500

int bigdata[DATASIZE];
//int bigtime[DATASIZE];

// Calibration sensor 
#define ST 8
