Temperature Controlled RGB LED

So i want to make a project where the temperature reading dictates the colour of the RGB LED (ie. red when hot, blue when cold).

I currently have an RGB LED and an LM35 temperature sensor and know how to use them separately, but do not know how i can convert the temperature readings into 0-255 values.

Any help?
Thanks in advance.

matt559:
but do not know how i can convert the temperature readings into 0-255 values.

Math? Or you could try the map function. You'll have to think a little bit about how the temperatures should map to colors.

Forget the code for a minute. Work it out on paper. Once you figure out the math, making it into code is the easy part.

I was more looking for the actual code terms that could accomplish the conversion, and the 'map' function seems to achieve this so, thank you.

matt559:
I was more looking for the actual code terms that could accomplish the conversion, and the 'map' function seems to achieve this so, thank you.

You can't create the code until you have the math. Trying to do it the other way round is a recipe for frustration.