Grove Ultrasonic not working properly?

Generally, you need to wait after reading an ultrasonic sensor, so that any echoes die away. Your code is pinging continuously.