So I have written this code to cycle one RGB through three colors. Being a total noob, I cobbled the code together from several sources from Google searches and YT vids. I understand most of what is going on with the exception of this line -
void RGB_color(int red_light_value, int green_light_value, int blue_light_value)
I have several colors // out as when I left them in the RGB cycles through them all. However, this confuses me as I thought I defined the pins and name of the pins and called them with the Analog Write commands. I left the other colors in there as I have use for them later and thought they would not be displayed.
So I have three questions what does this command do:
void RGB_color(int red_light_value, int green_light_value, int blue_light_value)
Why does the RGB cycle through the other colors when on R G B are called with the Analog Write
And why is nothing required in void set up.
int red_light_pin= 10;
int green_light_pin = 11;
int blue_light_pin = 12;
void setup() {
}
void loop()
{
RGB_color(255, 0, 0); // Red
delay(1000);
RGB_color(0, 255, 0); // Green
delay(1000);
RGB_color(0, 0, 255); // Blue
delay(1000);
//RGB_color(255, 255, 125); // Raspberry
//delay(1000);
//RGB_color(0, 255, 255); // Cyan
//delay(1000);
//RGB_color(255, 0, 255); // Magenta
//delay(1000);
//RGB_color(255, 255, 0); // Yellow
//delay(1000);
//RGB_color(255, 255, 255); // White
//delay(1000);
}
{
analogWrite(red_light_pin, red_light_value);
analogWrite(green_light_pin, green_light_value);
analogWrite(blue_light_pin, blue_light_value);
delay (1500);
}