Go Down

Topic: multiMap() function - integer linear interpolation (Read 3 times) previous topic - next topic

robtillaart


After playing with my Sharp distancesensor - SHARP 2Y0A02 F 9Y - I needed a mapping from measurements upon centimeters. As the functions I found did not cover the whole range with the accuracy needed I decided to write a linear interpolation function. There was allready one on the playground called reMap() but that used floats, so I redid it in integer to improve performance and robustness. Furthermore I added some snippets how multiMap() can be used.

All remarks, improvements or good examples are - as allways - welcome.

Rob
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Graynomad

Sounds like a good idea, where's the code?

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

robtillaart

#2
Jan 28, 2011, 05:27 pm Last Edit: Feb 02, 2011, 12:17 am by robtillaart Reason: 1
Sorry - code and example snippets can be found on the playground - http://arduino.cc/playground/Main/MultiMap

Rob
[update 30-1-2011]
- didn't post the code here as small optimizations are planned
[update 2-2-2011]
- code on playground updated.

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

robtillaart

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Go Up