Hi all, I am playing with the HC-SR04 on my esp8266 today and found that the outputted cm value doesn't seem correct at all. it looks like this(see below). a very large value returned. btw, I am completely new to this iot. but I did played with the ultrasonic sensor once with the arduino uno a while back and the distance output seems correct. so, my question is that is it possible that there's a bug in the distance calculation? I highly doubt that. but just want to make sure. If not, what am I doing wrong here? thanks in advance
35964.50877192983 cm away
144735.33333333340 cm away
153507.50877193000 cm away
162278.77192982469 cm away
171052.05263157916 cm away
179822.78947368444 cm away
188593.07017543850 cm away
197371.64912280708 cm away
206141.92982456140 cm away
214913.57894736839 cm away
223685.52631578940 cm away
232456.89473684219 cm away
241229.26315789471 cm away
249997.29824561413 cm away
258771.82456140377 cm away
267546.50877192983 cm away
276315.40350877214 cm away
285087.42105263157 cm away
293859.31578947376 cm away
302631.43859649135 cm away
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi all, I am playing with the HC-SR04 on my esp8266 today and found that the outputted cm value doesn't seem correct at all. it looks like this(see below). a very large value returned. btw, I am completely new to this iot. but I did played with the ultrasonic sensor once with the arduino uno a while back and the distance output seems correct. so, my question is that is it possible that there's a bug in the distance calculation? I highly doubt that. but just want to make sure. If not, what am I doing wrong here? thanks in advance
I used the code straight from https://www.espruino.com/HC-SR04
output values: