I wonder... why is the map() function setup to use long ints?
I hacked mine (changed all the longs to floats) and it works the same.... except that it also now produces fractional results when necessary. Why would it be written with such a limitation?
In case anyone is interested is using this, edit the following files:
Near the bottom, replace the map function with this code:
float map(float x, float x1, float x2, float y1, float y2)
return (x - x1) * (y2 - y1) / (x2 - x1) + y1;
Next, edit the file arduino-1.x.x/hardware/arduino/cores/arduino/Arduino.h (to change the header for map()):
Again, near the bottom, replace the declaration for map() with this code:
float map(float, float, float, float, float);
That's it. Now, map() will return exact values instead of values truncated to integers.
Or... if you're afraid to modify "stock" code, you can just ADD the code above and give it a different name such as "fmap()"...