Go Down

Topic: Controlling a RGB LED via temperature HELP (Read 7163 times) previous topic - next topic


Hi I have a DHT11 Temperature and humidity sensor, Single RGB LED and a Photocell.

I need to set up my board so that the RGB colour will match the room temperature (cold = blue hot - red) and with the photocell to control the brightness of the LED.

Could someone please help me here as I am completely new at this and have till monday to get it done!!!  :(

Thank you!


Sounds like you want us to do the (home)work for you.  Being "completely new at this", it's the wrong type of project to start with.  Learn how to use them first, how to turn on/off the LED, how to read the temperature, how to interpret the photocell ...


Giving your opinion of whether you think this is the right or wrong project for me to be doing isn't what I was asking and I don't need you to patronise me. And yes I can read a temperature from the DHT11 and I can adjust the brightness with the photocell. I am just unable to map a RGB colour to the temperature and blend the two scripts together.


You can't expect anyone to help you when you don't show what you've done or how.

How to use this forum


Apr 28, 2013, 04:13 pm Last Edit: Apr 28, 2013, 07:20 pm by Runaway Pancake Reason: 1

  • you can manage to read the temperature

  • you can manage analogWrites to the R, G, B to do colours

Knock out some functions [red(), orange(), yellow(),...]
Then you could get by with some ifs for determining with which of those colour functions to execute:
Code: [Select]

if (temp>10 && temp < 20)
if (temp >= 20 && temp < 30)

...and so on

OK ?
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

Go Up