             Serial.write(' ');
             Serial.print(infrared_sensors_control.get_distance(sensor_index));
             Serial.write('#');
-            i++;
+            i += 2;
           }
         else
         if (tmp_str[i] == 'D' || tmp_str[i] == 'd'){// disables motor

            Serial.write(' ');
            Serial.print(ultrasonic_sensors_controller.getDistanceForSensor(sensor_index));
            Serial.write('#');
            i++;
          }
        else
          if (tmp_str[i] == 'I' || tmp_str[i] == 'i'){// infrared

              Serial.print(motor_speed); 
              Serial.write(' ');
              Serial.print(motor_acceleration); 
              i += 4;
            }
            else
              if (tmp_str[i + 1] == 'P' || tmp_str[i + 1] == 'p'){ // get potentiometer min max home
