Hello,
I am trying to get higher precision on some of the PIDs. For example, when reading PID_DISTANCE, is it possible to get a reading with decimal places or is it strictly integers?
I've noticed that the obd.read() command only accepts int values, and does not allow floats, doubles, or bytes.
Thanks for the help,
Anthony
OBD-II Precision
Re: OBD-II Precision
It's a 16-bit integer value in km. You can measure distance traveled by sampling OBD speed and time elapsed.
Re: OBD-II Precision
Thanks Stanley. I'm trying to think what would be an accurate way to measure this. I think I understand what you are saying.
So use the PID_SPEED function and the Arduino function millis(). Find the difference between each millis() read and multiply that by PID_SPEED. Does that sound right?
Thanks.
So use the PID_SPEED function and the Arduino function millis(). Find the difference between each millis() read and multiply that by PID_SPEED. Does that sound right?
Thanks.
Re: OBD-II Precision
Basically it is like:
distance = (v1 + v2) * (t2 - t1) / 2;
distance = (v1 + v2) * (t2 - t1) / 2;
Re: OBD-II Precision
Perfect, that was along the lines of what I was thinking. Thanks Stanley!