Lidar lite v3HP- Changing measurement unit from cm to meters

I am using an Lidar Lite v3HP distance sensor with an Arduino Uno R4, and would like to display measurement units in meters as opposed to centimeters, and I've searched around unsuccessfully for code to that effect. Moving the decimal seems simple enough, as the Lidar itself is a closed system using the speed of light and its return, etc. Your thoughts are appreciated!

The recommended approach is to divide cm measurements by 100, or multiply by 0.01.

2 Likes

That is the nice part of the Metric system you just move the decimal with either multiplication or division.

No one would post code on the internet saying "look, everybody, I created a code that converts centimetres to metres". Everyone would just laugh at them.

Yes, it is trivially simple.

How the sensor works is completely irrelevant to converting centimetres to metres.

1 Like

Try this link and spend some time so you understand what you are reading. The metric system is used almost everywhere in the world except mainly the US but the US does use it in its technical world. https://www.cuemath.com/measurement/metric-system/

I might have been a bit vague in my first posting- I'm specifically looking to display the output with fewer decimal places in real-time- I'm quite familiar with convert cm to m or km for that matter :wink:
The LIDAR will be used to gauge the vehicle-to-vehicle distance in real time to help determine the feasibility/safety of a lane change.
Using a Sharpie to mark the decimal would work sometimes, but seems like a cop-out. I'm learning how to use and alter the code in the libraries, just have not come across any scripts to do it.

Serial.print(x,n); //for n digits past the decimal point

The LIDAR will be used to gauge the vehicle-to-vehicle distance in real time to help determine the feasibility/safety of a lane change.

What has that to do with the number of decimal places? It still isn't clear what the actual question is.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.