I want 1 - 10 to be Green, 2 - 20 Red, and 3 - 30 Yellow.
?? they overlap?
do you mean:
for (int i = 0 ; i < 10 ; i++) // zero through nine
{
}
for (int i = 10 ; i < 20 ; i++) // ten through nineteen
{
{
for (int = 20; i < 30 ; i++) // twenty through twenty-nine
{
}
you can use the same "i" counter variable because they hold their scope during the for loop only...
Yeah, I think that is what I wanted and no, I didn't want them over lapping. Its been a long time since I'vs done any programming. I've been trying to find good refresher tutorials, but this should hold me over until I do.
define your ledPins in an array, for example. Note that you need not start on the zero pin as the first pin is assigned the zero position in the array.
const int led [30] = {
3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32}; // you must have a Mega!
//
void setup()
{
for (int i = 0; i < 30; i++)
{
pinMode(led[i], OUTPUT);
}
for (int i = 0 ; i < 10 ; i++) // zero through nine
{
digitalWrite(led[i], HIGH);
}
for (int i = 10 ; i < 20 ; i++) // ten through nineteen
{
digitalWrite(led[i], HIGH);
}
for (int i = 20; i < 30 ; i++) // twenty through twenty-nine
{
digitalWrite(led[i], HIGH);
}
}
//
void loop()
{
}
for (int i = 0 ; i < 10 ; i++);// zero through nine
ledsA = CRGB::Blue; { } for (int i = 10 ; i < 20 ; i++); // ten through nineteen ledsA = CRGB::Lime; { { for (int i = 20; i < 30 ; i++); // twenty through twenty-nine ledsA = CRGB::Yellow; { } Thank you