Im using Ultrasonic Sensor With Qwiic and NULA Mini ESP32-C6 connected by Qwiic
I have some errors with the ultrasonic measures the highest value i can get from getDistance() is 1053
code snipets from example:
#include “Ultrasonic-distance-sensor-easyC-SOLDERED.h”
…
hc.getDistance()
hc.getDuration()
Outpout:
Distance: 1053. Time: 61968
one issues is that this getDistance shoud return distance in cm but it returns the milimeter distance in both ways so this is needed to get cm
int distance = hc.getDistance() / 20; (10 to get cm and 2 to not get both ways)
the second is when i move the object more then 50cm away the counter resets to 0, both distance and the time.
so if i mesure something at 51 cm i get 1 cm instead, 52 cm i get 2 cm.
looks like the internal library is reading only 2 registers so with 16bits we cant get bigger values
the documentation here
says it can measure to 4meters currently this is not really true as it tops out at 0.5meters