Ultrasonic sensor not responding

I am using 1.0.1

Automative:
First of, wich version of the IDE are you using?

I quote form an old forum post:
which version of the IDE are you using?

There was a bug that caused the pulsIn() code to premature timeout, see - http://arduino.cc/forum/index.php/topic,74813.0.html -
it should be fixed in the 1.0.1. version.

Also I read that pulseIn is not good for use with an ultrasonic sensor but it should give you some result.

In my opinion, you can use pulseIn with every PIN, correct me if I'm wrong someone...

TheWave:

Automative:
Hi,

The ultrasonic sensor will make an ultrasonic sound when you put the trigger pin HIGH for a certain amount of time.

The duration of the signal that the sensor gives back on the Echo pin will be your distance.

Try the following code:

#define trigPin 12

#define echoPin 13

void setup() {
 Serial.begin (9600);
 pinMode(trigPin, OUTPUT);
 pinMode(echoPin, INPUT);
}

void loop() {
  long duration, distance;
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration/2) / 29.1;
  if (distance >= 200 || distance <= 0){
    Serial.println("Out of range");
  }
  else {
    Serial.print(distance);
    Serial.println(" cm");
  }
  delay(500);
}

It just says out of range repeatedly. Do you think the sensor is broken? I was hoping not based on the sounds. Also, is it ok to try it with different pins, like 8 and 9 or something?