Output a high-level pulse in Trig pin lasting for least 10us. Then the module begins to transmit ultrasonic. At the same time, the Echo pin will be pulled up. When the module receives the returned ultrasonic, the Echo pin will be pulled down. The duration of high level in Echo pin is the total time of the ultrasonic from transmitting to receiving, s=vt/2, which is used to operate the HC-SR04 in Arduino.