Go Down

Topic: Need help programming RGB's to be different colors  (Read 71 times) previous topic - next topic

jastaggar132

Nov 18, 2017, 12:11 am Last Edit: Nov 18, 2017, 12:16 am by jastaggar132
Hello I am confused on how to add another code to another pin. I have attached my current design but I am having problems with programming the second RGB to blink. Any suggestions on what I could do? I would like the second RBG to blink primary colors only. I have also attached my code. My current design https://imgur.com/nPrfu5L

AWOL

Quote
I have also attached my code
If you really wanted help, you'd have posted your code.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

jastaggar132

Kinda new to this but here


int redPin = 10;
int greenPin = 8;
int bluePin = 9;


void setup()
{
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);

}
void loop()
{

setColor(255, 255, 0); // yellow
delay(250);
setColor(80, 0, 80); // purple
delay(250);
setColor(0, 255, 255); // aqua
delay(250);
}
void setColor(int red, int green, int blue)
{
#ifdef COMMON_ANODE
red = 255 - red;
green = 255 - green;
blue = 255 - blue;
#endif
analogWrite(redPin, red);
analogWrite(greenPin, green);
analogWrite(bluePin, blue);
}

spycatcher2k

Quote
Kinda new to this but here
No excuse for not reading the rules for using the forum - You still have not done this, and posted incorrectly!
-=-
http://www.uk-pcb.co.uk - UK Based PCB Fab & Assembly Company
Design & Assembly work undertaken - Arduino repairs & testing - PM for details. Arduino & C# PC programming.

wvmarle

Code tags missing.
No indentation making code hard to read.
Which of the code is for the first LED, and which part for the second? The code appears to be dealing with three LEDs total.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

Go Up