Arduino Forum

General Category => General Discussion => Topic started by: trickytune on Jul 08, 2018, 06:12 am

Title: Array or table interpolation
Post by: trickytune on Jul 08, 2018, 06:12 am
Hi I have been searching around and keep getting sidetracked for hours lol.
I am trying to use an array or similar that I can interpolate.
Lets say I have an analog input with the values of 1-1023
And I know some of the values I want for output

e.g.

0 = 0
400 = 100
600 = 100
1023 = 30

Obviously 200 is 20, 500 is 100 etc.
I have looked at multimap and a few others but I am a bit lost when the numbers go up and down.

I may wish to add another row or column to make it 2D at a later date.
Title: Re: Array or table interpolation
Post by: trickytune on Jul 08, 2018, 08:01 am
I take that back. multiMap is perfect and does exactly what I wanted.
I could not work out how to implement it until I found some code that worked and I changed some things around.
Still have to remove all the non relevant stuff but it works.