While driving a load with a microcontroller, you may add resistors on either side. This is because the current entering the LED and leaving out of the LED is the same. So if a resistor is used on the high side or low side, it would limit the current. They can be used on either side and either way because they are not polarized.
In such configurations, resistors limit current flowing through an active component (LED in your case). Considering Kirchoff's Law, it doesn't matter if the resistor is on the positive or the negative side of the LED. It would limit the same amount of current irrespective of the positive side or negative side of LED.
More reading: Kirchhoff's Laws
I've found solution. Maybe I was wrong from the beginning..
Solution
I've done as described in the link above, connected trig and echo with 1.8k resistor and A7 pin to trig pin. I should have googled more.
Best Answer
From the link:
It acts as a pull-down resistor that drives the input to micro-controller to a known logic
0
, in case your sensor's output floats for some reasons.