cant find lessons on rgb led

okay, I am working on a project with rgb leds and I can't find anywhere where I can program the arduino to store a variable such as the color yellow or orange to later call it like digitalWrite(yellow,HIGH); Or make an array variable yellow[] ={255,255,0}; the numbers represent the rgb light and intensity.

U mean

define yellow 2 ?

or byte yellow =2 ? I don't know if u are the asking the right question here.

casualgamer24: okay, I am working on a project with rgb leds and I can't find anywhere where I can program the arduino to store a variable such as the color yellow or orange to later call it like digitalWrite(yellow,HIGH); Or make an array variable yellow[] ={255,255,0}; the numbers represent the rgb light and intensity.

I find that terribly hard to believe. There are literally thousands. There might not be one that looks like exactly what you want to do, but storing a set of three values is definitely covered many times over.

It looks like you already know how to do it as an array of three values. What part is stopping you from writing those three values in three analogWrite statements to your LED?

I haven’t done this in a while, but what I did is define a colour array:

byte colour [][3] =
{
  {0, 0, 0},
  {255, 0, 0},  //red
  {0, 255, 0},  //green
  {0, 0, 255},  //blue
  {225, 255, 105},  //gray
  {255, 0, 255},  //magenta
  {60, 0, 255},  //violet
  {255, 200, 150},  //alt web pink
  {255, 255, 255}  //full on
};

and a function:

void backlight(byte c)
{
  analogWrite(redLedPin, 255 - colour[c][0]);
  analogWrite(greenLedPin, 255 - colour[c][1]);
  analogWrite(blueLedPin, 255 - colour[c][2]);
}

and call it like:

if (tm.Hour < 6 || tm.Hour > 20)  //night mode
          backlight(3); //blue
        else if (tm.Hour < 7)  //morning mode
          backlight(6);  //violet
        else if (tm.Hour > 18)  //evening mode
          backlight(2);  //green

At the time I was too lazy, but I should have named the offsets, like:

#define BLUE 3

and then:

backlight( BLUE );

Is google broken where you live? here is a tutorial or another one... first hits on Google amongst zillions

Is it that type of RGB LED you have in mind ?

J-M-L: Is google broken where you live?

Just FYI, keep in mind that there are almost 2 billion people for whom that is actually the case.

Fair enough indeed if OP is in one of those countries (Hence the links I did provide)

J-M-L: Fair enough indeed if OP is in one of those countries (Hence the links I did provide)

Yeah, I used Google to find examples of RGB code when I did that project. I think there are even some good examples on this site if you use the search icon at the upper right.