I have an arduino using fastLED with a strip of 600 ws2812b lights. I'm running the following code:
#include "FastLED.h"
#define DATA_PIN 5 // change to your data pin
#define COLOR_ORDER GRB // if colors are mismatched; change this
#define NUM_LEDS 600 // change to the number of LEDs in your strip
#define BRIGHTNESS 32
#define WRAP_NUM 55
#define LED_TYPE WS2812B
CRGB leds[NUM_LEDS];
int startIndex=0;
int bottom=1;
void setup()
{
delay(3000);
FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS);
FastLED.setBrightness(BRIGHTNESS);
}
void loop()
{
shapeTwirl();
}
void shapeTwirl()
{
FastLED.clear();
static int heart[]={bottom*WRAP_NUM};
for(int i=0;i<sizeof(heart);i++)
{
leds[(heart[i]+startIndex)]=CRGB::Red;
}
FastLED.show();
delay(70);
startIndex=(startIndex+1)%WRAP_NUM;
}
I have my lights in a circle and this makes a red dot wrap around the circle. However, a blue dot roughly 100 lights away also spins around. There is nothing in my code to make blue light. I have tracked this down to using
int bottom=1;
If I replace bottom with a number in the code, I get rid of the blue dot and it works properly. The problem is also solved if I #define bottom 1;. It doesn't matter if I define bottom where it is now or within shapeTwirl. This leads me to believe there is something wrong with using a variable for bottom, but i've tried using an int, static int, unsigned int to no avail.
Why are the wrong lights turning on?
I'm using an arduino uno to control the lights and external power to power them.