Solid Lights Whilst Flashing others

Hello. First time poster. Long time lurker. Thanks for reading. Have always been able to find what I'm after for the most part until now.

I have a sketch with 16 addressable leds. I have some lights flashing, however, I don't want them all to flash and would like some solid and not effected by the delay.

How may I achieve this? Thanks for your time and insight.

Welcome.


We need more information so we can help you.


Show us your attempt.

Always show us a good schematic of your proposed circuit.
Show us good images of your ‘actual’ wiring.
Give links to components.


In the Arduino IDE, use Ctrl T or CMD T to format your code then copy the complete sketch.

Use the < CODE / > icon from the ‘posting menu’ to attach the copied sketch.

Thank you for the welcome.

I have not attempted this because I'm am almost uncertain of how to acheive it

#include <FastLED.h>
#define NUM_LEDS 16
#define DATA_PIN 5
#define COLOR_ORDER GRB
#define CHIPSET WS2812
#define BRIGHTNESS 5
#define VOLTS 5
#define MAX_AMPS 500

CRGB leds[NUM_LEDS];





void setup() {
  FastLED.addLeds<CHIPSET, DATA_PIN, COLOR_ORDER>(leds,NUM_LEDS);
  FastLED.setMaxPowerInVoltsAndMilliamps(VOLTS, MAX_AMPS);
  FastLED.setBrightness(BRIGHTNESS);
  FastLED.clear();
  FastLED.show();

}

void loop() {

  

  //Left Meter
  leds[4] = CRGB::Purple;
  leds[5] = CRGB::Aqua;
  leds[6] = CRGB::Aqua;
  leds[7] = CRGB::Aqua;
  leds[8] = CRGB::Aqua;
  leds[9] = CRGB(254, 80, 0);
  leds[10] = CRGB(254, 80, 0);
  leds[11] = CRGB(254, 80, 0);
  FastLED.show();
  FastLED.clear();
  delay(70);
  leds[4] = CRGB::Black;
  leds[5] = CRGB::Black;
  leds[6] = CRGB::Black;
  leds[7] = CRGB::Black;
  leds[8] = CRGB::Black;
  leds[9] = CRGB(0, 0, 0);
  leds[10] = CRGB(0, 0, 0);
  leds[11] = CRGB(0, 0, 0);
  FastLED.show();
  FastLED.clear();
  delay(60);
  ///////////////////////
  




  //Right Meter

  leds[0] = CRGB::Aqua;
  leds[1] = CRGB::Aqua;
  leds[2] = CRGB::Aqua;
  leds[3] = CRGB::Purple;
  leds[15] = CRGB::Aqua;
  leds[14] = CRGB(254, 80, 0);
  leds[13] = CRGB(254, 80, 0);
  leds[12] = CRGB(254, 80, 0);
  FastLED.show();
  FastLED.clear();
  delay(70);
  leds[0] = CRGB::Black;
  leds[1] = CRGB::Black;
  leds[2] = CRGB::Black;
  leds[3] = CRGB::Black;
  leds[15] = CRGB::Black;
  leds[14] = CRGB(0, 0, 0);
  leds[13] = CRGB(0, 0, 0);
  leds[12] = CRGB(0, 0, 0);
  FastLED.show();
  FastLED.clear();
  delay(60);
  ///////////////////////
 
 


}

Here is my code, I certainly hope I did this right, so please forgive the ignorance if not so.

I just can't wrap my brain on how to keep the purple lights on while the others do their thing. Maybe I'm just not wording it right when I search. So, any help on this is greatly appreciated. Thanks again.

FastLED.show();
FastLED.clear();

  • What do you think happens above ?

The process should be set the colour of each pixel before you call show.

#include <FastLED.h>
#define NUM_LEDS 16
#define DATA_PIN 5
#define COLOR_ORDER GRB
#define CHIPSET WS2812b
#define BRIGHTNESS 5
#define VOLTS 5
#define MAX_AMPS 500

CRGB leds[NUM_LEDS];

void setup() {
  FastLED.addLeds<CHIPSET, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS);
  FastLED.setMaxPowerInVoltsAndMilliamps(VOLTS, MAX_AMPS);
  FastLED.setBrightness(BRIGHTNESS);
  fill_solid(leds, NUM_LEDS, CRGB::Aqua);
}

void loop() {
  static uint32_t prevMills = 0;
  const uint16_t period = 1000;
  static bool state = false;
  if (millis() - prevMills >= period) {
    prevMills += period;
    state = (prevMills / 1000) % 2;
    for (byte i = 0; i < NUM_LEDS; i += 4) {
      if (state)leds[i] = CRGB::DarkOrange;
      else leds[i] = CRGB::Black;
    }
    FastLED.show();
  }
}

Thanks for your response, however, this didn't achieve the effect I was after.

Aren't they set to their color, before the show command?

“ The process should be set the colour of each pixel before you call show .”

These agree with each other.


  • What do you think happens below ?

FastLED.show();
FastLED.clear();

The brightness value 5 in the row " #define BRIGHTNESS 5 " is very low.
Try running your code with a value in the order of 100 or even more.

See the simulation.
"PiscaPisca.ino - Wokwi ESP32, STM32, Arduino Simulator
What effect do you want to achieve with your code?

of course not. you use it for learning and make effect you was after by yourself. here is not a wish fulfillment service.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.