connecting HY -SRF 05 sensor to arduino uno

hi everyone

i recently bought the HY -SRF 05 sensor but cant connect it to the arduino uno.

here the code im using

/*
Tested with HY-SRF05, HC-SR04
Assuming a room temp of 20 degrees centigrade
The circuit:

  • VVC connection of the sensor attached to +5V
  • GND connection of the sensor attached to ground
  • TRIG connection of the sensor attached to digital pin 12
  • ECHO connection of the sensor attached to digital pin 13
    */

const int TRIG_PIN = 12;
const int ECHO_PIN = 13;

void setup() {
// initialize serial communication:
Serial.begin(9600);

pinMode(TRIG_PIN,OUTPUT);
pinMode(ECHO_PIN,INPUT);
}

void loop()
{
long duration, distanceCm, distanceIn;

// Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
digitalWrite(TRIG_PIN, LOW);
delayMicroseconds(2);
digitalWrite(TRIG_PIN, HIGH);
delayMicroseconds(10);
digitalWrite(TRIG_PIN, LOW);
duration = pulseIn(ECHO_PIN,HIGH);

// convert the time into a distance
distanceCm = duration / 29.1 / 2 ;
distanceIn = duration / 74 / 2;

if (distanceCm <= 0){
Serial.println(“Out of range”);
}
else {
Serial.print(distanceIn);
Serial.print("in, ");
Serial.print(distanceCm);
Serial.print(“cm”);
Serial.println();
}
delay(1000);
}

i connected the trig to digital pin 12 and the echo to pin 13 the vcc to 5v but when i connect the ground the the ground on the arduino it switches off

any reason why this happens … thanks

Disconnect pins 11,12 If the arduino shuts down when power is connected then the sonsor is defective