Interesting, regarding the first comment at the beginning I did write the variable as "long" but it brings me really weird numbers and precisely as the eyes get closer to the object the displayed number increases .. so I changed to "double" and now it gives very good results but as mentioned sometimes it "lies" For a few seconds in an incomprehensible way ...
: Regarding the second note set
duration = pulseIn(echoPin, HIGH, 30000ul);
.I did not see any change when I defined it that way
Anyway, the idea someone wrote here to do by two components of hc-sr04 is a very likable idea. Is it possible to do the same with one component and compare between 2
? different readings