Here's my question though - should this issue be documented anywhere?
Fractional remainders are truncated, and are not rounded or averaged.
I'm sure I'm not the first person to find this issue...
Am I crazy?
I know that for the most part, with analog in and out, this isn't a big deal
but it still seems really odd to me that I can't find any discussion of the issue
map(x, 0, 1023, 0, 1);
map(x, 0, 1024, 0, 2);
Is there any reason that couldn't be clarified?
a) steer users to a new mapping function which handles the +/-1 adjustment to the endpoints and considers using rounding.b) warn that the function is based on hybrid math concepts which eventually break down for smaller ranges. It should probably warn that its 10-bit to 8-bit mapping example is not optimal, and could drive the message home by showing the problem of mapping to a single bit.c) warn that the function does not continue the regular stair-step pattern when crossing the in_min boundary.d) clean up official arduino sample code to use proper mapping techniques
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16