I have this:
CRGB leds[NUM_LEDS];
CRGB leds2[NUM_HEADLIGHTS];
FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.addLeds<LED_TYPE, HEADLIGHTS, COLOR_ORDER (leds2,NUM_HEADLIGHTS). setCorrection(TypicalLEDStrip);
But I can't find a way to just FastLED.clear() first set of (leds).... without clearing the second....(leds2)
here is my whole code
#include <FastLED.h>
#include <Adafruit_LIS3DH.h>
#include <Adafruit_Sensor.h>
//#include <Adafruit_NeoPixel.h>
Adafruit_LIS3DH lis = Adafruit_LIS3DH();//G-force sensor
#define NUM_LEDS 26
#define LEDSEGMENT 3 //segment length of lit pixels
CRGB leds[NUM_LEDS];
//CRGB color;
#define HEADLIGHTS 10 //headlights
#define NUM_HEADLIGHTS 2
CRGB leds2[NUM_HEADLIGHTS];
CRGB color[] = {CRGB::Green, CRGB::Orange, CRGB::White,
CRGB::Violet, CRGB::LightGreen, CRGB::DarkRed,
CRGB::MediumAquamarine, CRGB::SkyBlue
};
#define DATA_PIN 9 //neopixel pin data front/rear turn signals
#define BRIGHTNESS 100 //neopixel brightness
// neopixel variables
int LEDValue;
int LEDColor;
int LEDRun;
#define COLOR_ORDER GRB
#define LED_TYPE WS2812B
int colorChoice = 0;
//assign LED pins
#define FRONTGREENLED 11
#define REARREDLED 12
//non blocking PWM led controls
int LedShow = 100; // runs through led fade 'if' statement 'x' times
int brightness = 0; // initial brightness of turn signal leds (0-255)
int fadeAmount = 3; //fade by this much
bool runFlag = false; //flag T/F for motion sensor 'z'
int ledRunCount; //keeps track of how many ledShow runs
unsigned long previousMillis = 0; //store last Led update
int interval = 50; //fade at this interval
void ALLLEDSON() {
analogWrite(FRONTGREENLED, 150);
analogWrite(REARREDLED, 150);
}
void setup() {
Serial.begin(115200);
delay(2000);
lis.begin(0x18);
lis.setRange(LIS3DH_RANGE_2_G); // 2, 4, 8 or 16 G!
lis.setDataRate(LIS3DH_DATARATE_50_HZ);//1,10,25,50,100,200,400
randomSeed(analogRead(23));
pinMode(HEADLIGHTS, OUTPUT);
pinMode(FRONTGREENLED, OUTPUT);
pinMode(REARREDLED, OUTPUT);
ALLLEDSON();//turn on F and R leds
// initiate the LED strip
//FastLED.addLeds<WS2811, DATA_PIN>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
//FastLED.addLeds<WS2812, DATA_PIN, GRB>(leds, NUM_LEDS);
FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.addLeds<LED_TYPE, HEADLIGHTS, COLOR_ORDER>(leds2, NUM_HEADLIGHTS).setCorrection(TypicalLEDStrip);
FastLED.setBrightness( BRIGHTNESS );
colorChoice = 0;
for (int x = 0; x < NUM_HEADLIGHTS; x++) {
leds2[x] = color[6];
}
FastLED.show();
delay(3000);
}
void loop() {
unsigned long currentMillis = millis();
/* //[u]I want these to stay lit[/u]
for (int x = 0; x < NUM_HEADLIGHTS; x++) {
leds2[x] = color[3];
FastLED.show();
}
*/
//get a new sensor event, normalized
sensors_event_t event;
lis.getEvent(&event);
// Map function here
LEDValue = map(event.acceleration.x, -18, 17, 0, NUM_LEDS);//have to adjust a bit to center
LEDColor = map(event.acceleration.y, -10, 10, 0, 10);//adjust to change color
LEDRun = map (event.acceleration.z, 0, 20, 0, 10);
if (LEDColor < 4 || LEDColor > 6) {
colorChoice = colorChoice + 1;
if (colorChoice > 7) {
colorChoice = 0;
}
}
FastLED.clear();//clears ALL leds on both strips
if (LEDValue <= LEDSEGMENT) {
for (int led = 0; led <= LEDValue; led++) {
leds[led] = color[colorChoice];
}
FastLED.show();
}
else {
for (int led = LEDValue - LEDSEGMENT; led < LEDValue; led++) {
leds[led] = color[colorChoice];
}
FastLED.show();
}
if (LEDRun < 4 || LEDRun > 6) {
runFlag = true;
}
if (runFlag == true) {
for (int i = 0; i < LedShow; i++) {
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
analogWrite(FRONTGREENLED, random(brightness));
analogWrite(REARREDLED, random(brightness));
//for (int i = 0; i < LedShow; i++) {
brightness = brightness + fadeAmount;
if (brightness <= 0 || brightness >= 150) {
fadeAmount = -fadeAmount;
}
ledRunCount ++;
if (ledRunCount == LedShow ) {
runFlag = false;
ledRunCount = 0;
analogWrite(FRONTGREENLED, LOW);
analogWrite(REARREDLED, LOW);
}
}
}
}
else {
ALLLEDSON();
}
//Serial.println(event.acceleration.y);
//Serial.println(LEDRun);
}//end loop
//Serial.println(event.acceleration.x);//uncomment one at a time to test
//Serial.println(LEDValue);
//Serial.println(event.acceleration.y);
//Serial.println(LEDColor);
//Serial.println(event.acceleration.z);
//Serial.println(LEDRun);
//Serial.println(runFlag);
//Serial.println(ledRunCount);