I am looking to take data from this unit and use the Arduino for datalogging...

http://www.innovatemotorsports.com/products/lc2.php

I have been looking all day for the information that I need but can't find it exactly. Is it possible to assign the value of 7.35 when the Arduino reads 0V and a value of 22.39 @ 5V? I'm sure it's possible but I am not good a maths.

The standard 'map()' function doesn't work with 'float' types, but it's not hard to do.
You could use this function:-

``````double mapf(double x, double in_min, double in_max, double out_min, double out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
``````

like this:-

``````int iVal = analogRead(A0);
float fResult = mapf((double)iVal, 0, 1023.0, 7.35, 22.39);
``````

You could use integers then divide by 100

735, 2239

Thank you for the assistance. I just wanted to make sure it was possible before committing. I kinda knew it was, I mean, almost anything is possible with these things.

Thanks again!

HeyBen:
I have been looking all day for the information that I need but can't find it exactly. Is it possible to assign the value of 7.35 when the Arduino reads 0V and a value of 22.39 @ 5V?

If you can design your Arduino program so it does not need floating point values (i.e. only uses integers) it will work much faster. Floating point maths is slow.

For example could you use 735 and 2239 rather than 7.35 and 22.39?

...R