ardumoto + ultra sonic sensor not working together [Solved]

I tryed to change the adresses from Timer1 to Timer2

like this:

/Timer1 (controls pin 12, 11)
TCCR1A = 0x00;
TCNT1 = 0x0000;
TCCR1B = 0x01;
***/

//Timer 2 (controls pin 10, 9)
TCCR2A = 0x00;
TCNT2 = 0x0000;
TCCR2B = 0x01

Now both motors are working but not the sensor :frowning:

int getDistance_sensor(){

  unsigned char pin = 0;
  unsigned int time_flag = 0;

  pinMode(TrigPin, OUTPUT); //pin is output
  pinMode(EchoPin, INPUT); // pin is now input
  digitalWrite(TrigPin, HIGH);
  delayMicroseconds(2);
  digitalWrite(TrigPin, LOW);
  delayMicroseconds(10);
  digitalWrite(TrigPin, HIGH);

  // wait for a LOW pulse
  //ultrasoundDuration = pulseIn(EchoPin, HIGH); // will not work for HIGH pulse
  
/***Timer1*** (controls pin 12, 11)
  TCCR1A = 0x00;
  TCNT1 = 0x0000;
  TCCR1B = 0x01;
  ***/
  
  //Timer 2 (controls pin 10, 9)
  TCCR2A = 0x00;
  TCNT2  = 0x0000;
  TCCR2B = 0x01;
  
  pin = digitalRead(EchoPin);
  while(pin)
  {
    pin = digitalRead(EchoPin);
    time_flag++;
    if(time_flag > TIMEOUT_OVERFLOW)
      break;
  }
  
  TCCR2B = 0x00;
  ultrasoundDuration = TCNT2;
  ultrasoundDuration = ultrasoundDuration / 16;
  // get results

  distance_sensor= ultrasoundDuration*0.017;

  return distance_sensor;
}