Pages: [1]   Go Down
Author Topic: Controlling a RGB LED via temperature HELP  (Read 3352 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!!!  smiley-sad

Thank you!
Logged

Colorado
Offline Offline
Edison Member
*
Karma: 47
Posts: 1562
Reviving dead brain cells with Arduinos.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 ...
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Colorado
Offline Offline
Edison Member
*
Karma: 47
Posts: 1562
Reviving dead brain cells with Arduinos.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

How to use this forum
Logged

Offline Offline
Faraday Member
**
Karma: 66
Posts: 2578
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So:
  • 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:
if (temp>10 && temp < 20)
{
red();
}
if (temp >= 20 && temp < 30)
{
orange();
}
...and so on

OK ?
« Last Edit: April 28, 2013, 12:20:29 pm by Runaway Pancake » Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Pages: [1]   Go Up
Jump to: