   if (indexRelax && middleRelax && ringRelax && abs(accel_X_reading) < 500){
     //now we use AcX as the only reference to turning angle, 
     //might be more useful to calculate angle instead but this is what we have now
-    state gestureState = idle;
+    gestureState = idle;
     turning_speed = 0; 
   }else if (!indexRelax && !middleRelax && !ringRelax){
-    state gestureState = backup;
+    gestureState = backup;
     turning_speed = 0;
   }else if (indexRelax && middleRelax && !ringRelax){
-    state gestureState = forward_drive;
+    gestureState = forward_drive;
     turning_speed = 0;
   }else if (accel_X_reading > 500){
-    state gestureState = left_turn;
+    gestureState = left_turn;
     turning_speed = (int8_t)accel_X_reading;//extract top 8 bits of accel_X_reading
   }else if (accel_X_reading < -500){
-    state gestureState = right_turn;
+    gestureState = right_turn;
     turning_speed = (int8_t)accel_X_reading;//extract top 8 bits of accel_X_reading
   }
 
+  //Serial.print("state is "); Serial.println(gestureState);
+  //Serial.print("turningSpeed is "); Serial.println(turning_speed);
+  //delay(333);
   /*Xbee send packets to inform*/
   //send_info(gestureState,turningSpeed);
-  
+
+
   /*
   Tmp=Wire.read()<<8|Wire.read();  // 0x41 (TEMP_OUT_H) & 0x42 (TEMP_OUT_L)
   GyX=Wire.read()<<8|Wire.read();  // 0x43 (GYRO_XOUT_H) & 0x44 (GYRO_XOUT_L)

 * at fist, index reading 766, middle reading 759, ring reading 796
 * choose middle value 650 to compare and determine if finers are relaxed or curled up
 * 
 * data acquisition rate: 781Hz loop speed without any computation, most time spent in writing 
 * to accelerometer. 
 */


int16_t accel_X_reading = 0; //lpf of AcX
bool indexRelax, middleRelax, ringRelax;
enum state {idle,forward_drive, backup, left_turn,right_turn};
state gestureState = idle;
uint8_t turning_speed; //in forward drive and backup mode, turning_speed is set to 0
                       //in turning state, turning speed is a function of accel reading
int16_t x; //test variable for interrupt

void ISR_interrupt(){
  /*upon an interrupt, send catapult throw command*/
  /*right now, we can turn on LED to indicate this event*/
  digitalWrite(13,HIGH);
  x++;
}
void setup(){
  Wire.begin();
  mpu.initialize();
  mpu.dmpInitialize();
