Use HC-SR04 Ultrasonic Sensor to move a motor

I kinda did:

  dist(); 

//This function vill show the distance (ctrl + M).