Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Disappointing Blink While Playing Results

  1. #1

    Disappointing Blink While Playing Results

    I have a Teensy 4.1 REV D Audio Board. Teensyduino Loader 1.57-beta1 version 3.1.0. FastLED library was update from 3.1 to 3.5. I have 150 WS2811 LEDs. As far as power, I have 5v 20A power supply, which feeds power to each LED strip. The Teensy is connected to the PC. The sketch is suppose to play a song and turn ON Three LEDs at the same time during small delay. After running the sketch, no all LEDs do what they are supposed to do. The LEDs turn ON but they don't follow the delay. The LEDs closer to LED ZERO seem to follow the delay. On the other hand, the ones far from ZERO blink slower or don't even turn ON at all. Beyond LED 80, nothing shows at all. Once I turn the music off, the three LEDs follow the sketch perfect. Can anyone, please, take a look? Thanks
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>
    AudioPlaySdWav           playSdWav1;
    AudioOutputI2S           audioOutput;
    AudioConnection          patchCord1(playSdWav1, 0, audioOutput, 0);
    AudioConnection          patchCord2(playSdWav1, 1, audioOutput, 1);
    AudioControlSGTL5000     sgtl5000_1;
    #include "FastLED.h"
    #define NUM_LEDS 150
    #define DATA_PIN 29
    #define led_Ini 0
    #define led_Med 5
    #define led_Fin 15
    #define millisec_Pause 50
    // Define the array of leds
    CRGB leds[NUM_LEDS];
    #define SDCARD_CS_PIN    10
    #define SDCARD_MOSI_PIN  11
    #define SDCARD_SCK_PIN   13
    void setup() {
      FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
      if (!(SD.begin(SDCARD_CS_PIN))) {
        while (1) {
          Serial.println("Unable to access the SD card");
    elapsedMillis blinkTime;
    void loop() {
      if (playSdWav1.isPlaying() == false) {
        Serial.println("Start playing");"gimme.WAV");
        delay(10); // wait for library to parse WAV info
      // print the play time offset
      Serial.print("Playing, now at ");
      Serial.println(" ms");
      // Turn the LED on, then pause
      leds[led_Ini] = CRGB::Red;
      leds[led_Med] = CRGB::Green;
      leds[led_Fin] = CRGB::Blue;
      // Now turn the LED off, then pause;
      while ( blinkTime  < millisec_Pause) {
      blinkTime = 0;
      // Now turn the LEDs off, then pause
      leds[led_Ini] = CRGB::Black;
      leds[led_Med] = CRGB::Black;
      leds[led_Fin] = CRGB::Black;;
      while ( blinkTime  < millisec_Pause) {
      blinkTime = 0;

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    You need a non-blocking driver. The default WS2811 driver doesn't play nice with other libraries, especially as you use more LEDs.

    The simplest way is WS2812Serial. To see how, open File > Examples > WS2812Serial > FastLED_Cylon. The main limitation with WS2812Serial is you're limited to only certain pins. Fortunately pin 29 happens to be one of the supported pins, so odds are good your code will "just work" if you simply change "WS2811" to "WS2812SERIAL", and add the extra include and define before the FastLED.h include, as shown in that example program.

  3. #3
    Thanks very much for your fastest response. It did the job!!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts