A big part of why it's so big, is that you haven't factored the code much (there is a lot of repetition of code patterns). Usually, that means that you have not structured your data and program in a hierarchical, top down way. You should use arrays, structs for data - functions and definitions for code - to greatly reduce the size of your code. This also has the benefit of making it easier to troubleshoot and maintain.
If you do this, implementing a new requirement such as you've posted above, will also be much, much easier. Unfortunately, I think you will find that most people will be reluctant to help you because of the code verbosity.
"I am only not able to create an if else statement which I should use in PHP or C#"
I don't understand what you mean by this statement above.
It looks like your making a color clock with temp. Am I correct? I on'y ask because I've recently done one of these myself for a friend. And, if I'm correct you want to map time of day to colors? Can you describe what you are looking for a little more, in human, not code?
jimLee:
"I am only not able to create an if else statement which I should use in PHP or C#"
I don't understand what you mean by this statement above.
It looks like your making a color clock with temp. Am I correct? I on'y ask because I've recently done one of these myself for a friend. And, if I'm correct you want to map time of day to colors? Can you describe what you are looking for a little more, in human, not code?
-jim lee
Hi Jim,
The statement above, is that I know how to handle with an if else statement. But for an Arduino it doesn't make any sense.
Yeah that's true, in the best case just only change RGB colors in a time range. the temp is just another thing.
What I really really want is the following;
3 or more time blocks which have set their own colors for the LEDs. Before, between or after a time range like below;
before 07.00in the morning all leds are off.
between 07.00 && 12.00 sunrise
between 12.00 && 18.00 daylight
between 18.00 && 22.00 evening
after 21.00 all leds are off
Again, the value of the temperature is not important for the first case.
The statement above, is that I know how to handle with an if else statement. But for an Arduino it doesn't make any sense.
Again, this makes no sense. Arduio, using c++ uses if then else just like everything else.
What I did, awhile ago, is create a multi color mapper. You can, with this, map time to a colors. You are welcome to try it. But, many people have trouble understanding my stuff.
If you like : My Arduino library folder The folder inside this you want is LC_baseTools That should contain all the bits you need to use it. There is a wiki attached and the library you want in there is colorObj.
jimLee:
Again, this makes no sense. Arduio, using c++ uses if then else just like everything else.
What I did, awhile ago, is create a multi color mapper. You can, with this, map time to a colors. You are welcome to try it. But, many people have trouble understanding my stuff.
If you like : My Arduino library folder The folder inside this you want is LC_baseTools That should contain all the bits you need to use it. There is a wiki attached and the library you want in there is colorObj.
Good luck
-jim lee
Hi Jim,
I really would like to try this. but in my case I would like to use something like an if else statement between 2 times. This because in the code which is in the topic attached I only have colors. But the next step is to control a relay for a H2O pump.
Like this example below;
if (displayTime < (0600)) {
Serial.println("Night");
red = nightR;
green = nightG;
blue = nightB;
}
else if (displayTime > (0700) && displayTime < (1100)) {
Serial.println("Sunset");
red = SSR;
green = SSG;
blue = SSB;
}
else if (displayTime > (1200) && displayTime < (1800)) {
Serial.println("Day");
red = dayR;
green = dayG;
blue = dayB;
}
else if (displayTime > (1800) && displayTime < (2000)) {
Serial.println("Sunrise");
red = SSR;
green = SSG;
blue = SSG;
}
else if (displayTime > (2000) && displayTime < (2100)) {
Serial.println("Evening");
red = SSR;
green = SSG;
blue = SSG;
}
else {
Serial.println("Night");
red = nightR;
green = nightG;
blue = nightB;
}