I want to clear 1 of two led strips on it's own, FastLed.clear() does all of them
i have seen numerous hints at using
FastLed[0].clear();
but the compiler complains with
Multigraph:63:14: error: 'class CLEDController' has no member named 'clear'
** FastLED[1].clear();**
** ^~~~~**
'class CLEDController' has no member named 'clear'
I have search round and although people say it works I can't find any reference to it in the multiplexing part of the GIT Documentation.
Am I mad or does it not work as people have suggested?
Thanks
Robin
#include <FastLED.h>
// How many leds in your strip?
#define NUM_LEDS 48
#define NUM_LEDS2 60
#define BRIGHTNESS 15
const int WaterG[24] = {0,1,6,7,8,9,14,15,16,17,22,23,24,25,30,31,32,33,38,39,40,41,46,47};
const uint32_t WaterC[24] = {CRGB::Blue,CRGB::Blue,CRGB::Blue,CRGB::Blue,CRGB::Blue,CRGB::Blue,CRGB::Blue,CRGB::Blue,CRGB::Green,CRGB::Green,CRGB::Green,CRGB::Green,CRGB::Green,CRGB::Green,CRGB::Green,CRGB::Green,CRGB::Green,CRGB::Green,CRGB::Red,CRGB::Red,CRGB::Red,CRGB::Red,CRGB::Red,CRGB::Red};
const int FuelG[24] = {2,3,4,5,10,11,12,13,18,19,20,21,26,27,28,29,34,35,36,37,42,43,44,45};
const uint32_t FuelC[24] = {CRGB::Red,CRGB::Red,CRGB::Red,CRGB::Red,CRGB::Orange,CRGB::Orange,CRGB::Orange,CRGB::Orange,CRGB::Yellow,CRGB::Yellow,CRGB::Yellow,CRGB::Yellow,CRGB::Green,CRGB::Green,CRGB::Green,CRGB::Green,CRGB::Green,CRGB::Green,CRGB::Green,CRGB::Green,CRGB::Green,CRGB::Green,CRGB::White,CRGB::White};
// For led chips like WS2812, which have a data line, ground, and power, you just
// nCRGB::CRGB::Red to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
// Clock pin only nCRGB::CRGB::Reded for SPI based chipsets when not using hardware SPI
#define DATA_PIN 8
#define DATA_PIN2 4
//#define CLOCK_PIN 13
// Define the array of leds
CRGB leds[NUM_LEDS];
CRGB leds2[NUM_LEDS2];
void setup() {
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS); // GRB ordering is typical
FastLED.addLeds<WS2812B, DATA_PIN2, GRB>(leds2, NUM_LEDS2); // GRB ordering is typical
FastLED.clear(); // clear all pixel data
FastLED.show();
FastLED.setBrightness(BRIGHTNESS);
Serial.begin(9600);
}
void loop() {
// Turn the LED on, then pause
for ( int x = 0 ; x < 24 ; x = x + 2 ){
Serial.println(x);
int led1 = WaterG[x];
int led2 = WaterG[x+1];
leds[led1] = WaterC[x];
leds[led2] = WaterC[x+1];
int led3 = FuelG[x];
Serial.print(" Fule G "); Serial.println(led3);
int led4 = FuelG[x+1];
Serial.print(" Fule G "); Serial.println(led4);
leds[led3] = FuelC[x];
leds[led4] = FuelC[x+1];
leds2[x] = CRGB::Red;
FastLED.show();
delay(100);
leds2[x] = CRGB::Black;
leds2[x+1] = CRGB::Blue;
FastLED.show();
delay(100);
}
// Now turn the LED off, then pause
//leds[0] = CRGB::Black;
FastLED[1].clear();
//FastLED.clear();
//CLEAR1();
delay(500);
}
