Greetings
I have been having a problem with this sketch. The value of global variable "i" is not being passed passed into the next function "lite". It remains at 0. Can anyone tell me what I am doing wrong.
I declare the variable "byte i" on the top of the sketch. Here is a piece of the sketch:
CRGB leds[NUM_LEDS];
byte i;
void setup() {
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
}
void loop()
{
for (byte i =8;i<64;i++)
{
lite();
delay (500);
}
}
void lite ()
{
leds*=CRGB::OrangeRed;*
CRGB leds[NUM_LEDS];
byte i;
void setup() {
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
}
void loop()
{
for ( i =8;i<64;i++)
{
lite();
delay (500);
}
}
void lite ()
{
leds=CRGB::OrangeRed;
FastLED.show();
}
Notice the difference? shrug
Carmene:
for (byte i =8;i<64;i++)
By putting that 'byte' in there you have created a new local variable called i. It has no connection with the original global variable of that name.
Steve
Thank you Steve for helping me out. I wasted a few hours trying to get past that simple problem. I appreciate you taking the time.
Regards,
Carmene
Thank you Idahowalker
I didn't understand what you were getting at, but I see it now.
Thanks