Ok, but when using multimap then i would need 2 arrays - temperatures and hues:
int hues[] = {150,140,130,120,110,100, 90, 80, 70, 60, 50, 40, 30, 20};
int temps[] = { 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33};
val = getTemp();
hue = multiMap(val, temps, hues, 14);
This way i would double the space used.
Here's the method how im mapping the values now:
void LedDriverClass::CalcHues(byte startTemp, byte endTemp, int startHue, int endHue)
{
double difference = (double)(startHue - endHue);
if (difference < 0)
difference = difference + 360;
double multiplier = difference/(endTemp - startTemp);
for(int i = tempStart; i<= tempEnd; ++i)
{
int hue = startHue - ((int) (i - startTemp)*multiplier);
if (hue < 0)
hue = hue + 360;
_colors[i] = hue;
}
}
Now when i call this method and give it for example startTemp 0 and endTemp 10, startHue 20 and endHue 0 then the result array would be:
_colors[] = {20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 0, ...}
All the rest values in the array would be 0 (thats is also intentional). Now when i get temperature something like 5 i would just do _colors[5] and i will get the hue value what is 10 in this example.
But as i said before, i might be moving this calculation off the arduino and just upload/send the pre calculated values to arduino. And the question is where would be the best place to store these values?
(Since i havent got the microSD shield working with my Wifly shield (see topic: http://arduino.cc/forum/index.php/topic,98025.0.html)) then storing the values on SD card is out of options)