         int modz = dz%10;
         dz = dz-modz;
     
-        tempx = ax;
-        tempy = ay;
-        tempz = az;
- */   
+        tempx = accelX;
+        tempy = accelY;
+        tempz = accelZ;
+           
         if(count < calibrateCount) {
           count++;
           if(count%100 < 50) {

            Serial.print("\tCount: ");
            Serial.println(count);

/*
            // display real acceleration, adjusted to remove gravity
            mpu.dmpGetQuaternion(&q, fifoBuffer);
            mpu.dmpGetAccel(&aa, fifoBuffer);
            mpu.dmpGetGravity(&gravity, &q);
            mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity);
            Serial.print("areal\t");
            Serial.print(aaReal.x);
            Serial.print("\t");
            Serial.print(aaReal.y);
            Serial.print("\t");
            Serial.print(aaReal.z);
            Serial.print("\t");

            Serial.print("Count: ");
            Serial.println(count);
  
        // Set acceleration values here
        dx = aaReal.x - tempx;
        dy = ay - tempy;
        dz = az - tempz;
        dx = (dx/10);               
        int modx = dx%10;
        dx = dx-modx;

            digitalWrite(moving, LOW);
            digitalWrite(level, LOW);
          }
          /*
          else if(abs(abs(xDeg)-abs(refX)) > 15) {
            digitalWrite(tilted, HIGH);
            digitalWrite(moving, LOW);
            digitalWrite(level, LOW);
          } 
           */
        }
        

        // blink LED to indicate activity
        blinkState = !blinkState;
