Hello everyone
Im getting 'LEDS' was not declared in this scope in my void setup third line in there. Im attaching the code if anyone could help me out that would be awesome
#include <FastLED.h>
#define NUM_LEDS 8
#define NUM_STEPS 7
#define NUM_COLORS 4
const byte dataPin = 9;
const byte potPin = A0;
const long colors[NUM_COLORS] = { 0x00000000, 0x00ff0000, 0x0000ff00, 0x000000ff};
// 0 is Black or pixel off. 1 = red, 2 = green, 3 = blue
const byte rows[NUM_STEPS][NUM_LEDS] =
{
{1, 1, 0, 0, 0, 0, 0},
{0, 1, 1, 0, 0, 0, 0},
{0, 0, 1, 3, 0, 0, 0},
{0, 0, 0, 3, 3, 0, 0},
{0, 0, 0, 0, 3, 2, 0},
{0, 0, 0, 0, 0, 2, 2},
{0, 0, 0, 0, 0, 0, 2},
};
CRGB leds[NUM_LEDS];
void setup()
{
Serial.begin(115200);
Serial.println("starting\n");
LEDS.addLEDS<WS2812, dataPin, GRB>(LEDS, NUM_LEDS);
LEDS.setBrightness(60);
for (int n = 0; n < NUM_LEDS; n++)
{
leds[n] = CRGB::Yellow;
}
}
void loop()
{
static unsigned long timer = 0;
unsigned long interval = 20;
if (millis() - timer >= interval)
{
timer = millis();
// get simulated signal from receiver. 1000us - 2000us
// map servo signal to choose active row
int row = map(readPot(), 1000, 2000, 0, NUM_STEPS);
for (byte n = 0; n < NUM_LEDS; n++)
{
leds[n] = colors[rows[row][n]];
}
FastLED.show();
}
}
int readPot()
{
int servoValue = analogRead(potPin);
servoValue = map(servoValue, 0, 1023, 1000, 2001);
//Serial.print("servo value ");
//Serial.println(servoValue);
return servoValue;
}