Some times I get the right value of the ultrasonic sensor and sometimes I get the value 3377.
You know why?
(deleted)
I using in HC-SRO4 and my code look like that:
long duration;
digitalWrite(TRIG_PIN ,LOW);
delayMicroseconds(5);
digitalWrite(TRIG_PIN, HIGH);
delayMicroseconds(10);
digitalWrite(TRIG_PIN, LOW);
duration = pulseIn(ECHO_PIN, HIGH);
int result = (duration/2) / 29.1;
value = result;
(deleted)
Moved your topic to it's current location / section as it is more suitable.
Could you take a few moments to Learn How To Use The Forum.
Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.
Best guess: timeout, no echo returned.