There are some flashing lights that i dont want

hello i have a problem of flashing in my lights do anyone know the problem?
i want it to be smooth as possible


#include "FastLED.h"

// Pride2015
// Animated, ever-changing rainbows.
// by Mark Kriegsman

#if FASTLED_VERSION < 3001000
#error "Requires FastLED 3.1 or later; check github for latest code."
#endif

#define DATA_PIN    11
//#define CLK_PIN   4
#define LED_TYPE    WS2811
#define COLOR_ORDER GRB
#define NUM_LEDS    200
#define BRIGHTNESS  32

CRGB leds[NUM_LEDS];


void setup() {
  delay(3000); // 3 second delay for recovery
  
  // tell FastLED about the LED strip configuration
  FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS)
    .setCorrection(TypicalLEDStrip)
    .setDither(BRIGHTNESS < 255);

  // set master brightness control
  FastLED.setBrightness(BRIGHTNESS);
}


void loop()
{
  pride();
  FastLED.show();  
}


// This function draws rainbows with an ever-changing,
// widely-varying set of parameters.
void pride() 
{
  static uint16_t sPseudotime = 0;
  static uint16_t sLastMillis = 0;
  static uint16_t sHue16 = 0;
 
  uint8_t sat8 = beatsin88( 87, 220, 250);
  uint8_t brightdepth = beatsin88( 341, 96, 224);
  uint16_t brightnessthetainc16 = beatsin88( 203, (25 * 256), (40 * 256));
  uint8_t msmultiplier = beatsin88(147, 23, 60);

  uint16_t hue16 = sHue16;//gHue * 256;
  uint16_t hueinc16 = beatsin88(113, 1, 3000);
  
  uint16_t ms = millis();
  uint16_t deltams = ms - sLastMillis ;
  sLastMillis  = ms;
  sPseudotime += deltams * msmultiplier;
  sHue16 += deltams * beatsin88( 400, 5,9);
  uint16_t brightnesstheta16 = sPseudotime;
  
  for( uint16_t i = 0 ; i < NUM_LEDS; i++) {
    hue16 += hueinc16;
    uint8_t hue8 = hue16 / 256;

    brightnesstheta16  += brightnessthetainc16;
    uint16_t b16 = sin16( brightnesstheta16  ) + 32768;

    uint16_t bri16 = (uint32_t)((uint32_t)b16 * (uint32_t)b16) / 65536;
    uint8_t bri8 = (uint32_t)(((uint32_t)bri16) * brightdepth) / 65536;
    bri8 += (255 - brightdepth);
    
    CRGB newcolor = CHSV( hue8, sat8, bri8);
    
    uint16_t pixelnumber = i;
    pixelnumber = (NUM_LEDS-1) - pixelnumber;
    
    nblend( leds[pixelnumber], newcolor, 64);
  }
}

i think i cant send an mp4 file of the lights in here and an normal gif file dosnt work for this issue it is above here but let me know its like flickering

ezgif-1-2b7e048034

looks like there are a # of LEDs and there "brightness" is constantly being adjusted

please describe what you expect the code to do
please describe what the code is doing that is the problem

No... not unless you describe the problem better.

like an gradient color changing led but it will flicker the lights sometimes

what exact do you need to know? i want it to be an gradient smooth changing like but sometimes between color changing it flickers the light

are you sure that math is correct? sine() ranges from +/-1. will sin16() be negative? what is the value of an unsigned variable, "b16" when set to a negative value?

idk but it is in every program i have tryed around 5 or 6 examples it is the same flickering
maybe with the power supply or anything?

sounds like you don't know and are making guesses.

test the hypothesis and print the values being computed to either confirm or dismiss the hypothesis.

if you think its the power supply, replace the power supply with one with more current

i just posted this on another thread

  • you should also develop and test code in stages. so trying just using one sensor and printing its results. add a 1 sec delay to minimize the output. then add the 2nd sensor and when satisfied remove the 1 sec delay

Thats right im a beginner in this.

But i use the output of the arduino the 5v port

For input it is on my pc usb

sounds like you're suggesting that there's a power problem that affect the LEDs but not the arduino which would be sensitive to a power glitch.

please print the computations and test your code with a single LED to "isolate the problem"

To power 200 LEDs? Get an external power supply, 5V / 15A should be OK.

And how to connect that?

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