             infoPk[i] = jelly;
           }
 
-while(z < 300 && h==0){
+while(z < 0 || z > 1203 || y < 0 || y > 1203 || x < 0 || x > 1203 || emg1 < 0 || emg1 > 1203 || emg2 < 0 || emg2 > 1200){
+break;  
+}
+while(z < 300 && z > 100 && h==0 && emg1 > 0 && emg1 < 1024 && emg2 >= 0 && emg2 < 1024){
     joint++;
     h++;
     if(joint > 4){

   }
   break;
}
  if(z > 460 && z < 470){
    h=0;
    }
    
while(joint == 1 && y > 700){
  i = i + 10;
  Dynamixel.setNGoalPositions(i, -1, -1, -1, -1);
  break;
  }
while(joint == 1 && y < 300){
  i = i - 10;
  Dynamixel.setNGoalPositions(i, -1, -1, -1, -1);
  break;
}

while(joint == 2 && y > 700){
  j = j + 10;
  Dynamixel.setNGoalPositions(-1, j, -1, -1, -1);
  break;
}
while(joint == 2 && y < 300){
  j = j - 10;
  Dynamixel.setNGoalPositions(-1, j, -1, -1, -1);
  break;
}

while(joint == 3 && y > 700){
  k = k + 10;
  Dynamixel.setNGoalPositions(-1, -1, k, -1, -1);
  break;
}
while(joint == 3 && y < 300){
  k = k - 10;
  Dynamixel.setNGoalPositions(-1, -1, k, -1, -1);
  break;
}

while(joint == 4 && y > 700){
    Dynamixel.gripper(OPEN);
    break;
}
while(joint == 4 && y < 300){
    Dynamixel.gripper(CLOSE);
    break;
}



int i = 2148;
int j = 2048;
int k = 2048;
int l = 2200;
int m = 1800;
int joint = 1;
int infoPk[24];
void actualName(){
