garmin / LIDARLite_Arduino_Library

High-performance optical distance sensing.
Apache License 2.0
181 stars 84 forks source link

LIDARLite v4 LED Library - max measurement 255cm #19

Open paw1682 opened 4 years ago

paw1682 commented 4 years ago

I am new to Arduino programming and playing around with a Sparkfun Redboard Artemis nano connected to a LIDARLite v4 LED via the Qwiik connector. When running the GetDistance example I noticed I could not obtain a measurement over 255cm. It would jump back to low measurments like 1cm. I noticed the in the library that the getDistance function was only declared as uint8_t (8bit). Thus the reason for the max value of 255. I changed the getDistance funtion declaration to unit16_t in both the LIDARLite_v4LED.h and the .cpp library files and now I am able to get measurements over 255cm. Attached are the updated files. LIDARLite_v4LED.zip

jmseitz commented 4 years ago

There is an example titled "GetDistance" for the LIDAR-Lite v3, but nothing of that name for the v4. Are you sure you are using examples and libraries intended for the v4?