ws2812b + teensy 4.0: LED strip only shows few frames when powered on

Status
Not open for further replies.
Thanks houtson, but modifying my basic sketch above to:
Code:
#include <WS2812Serial.h>
#define USE_WS2812SERIAL
#include <FastLED.h>

#define DATA_PIN    7
#define NUM_LEDS    1
#define NUM_STRIPS  1

CRGB leds[NUM_LEDS];

void setup() {
  // FastLED.addLeds<NUM_STRIPS, WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
  FastLED.addLeds<WS2812SERIAL, DATA_PIN, BRG>(leds, NUM_LEDS);
  leds[0] = CRGB::Red;
  FastLED.show();
}

void loop() {
}

...does not work for me.
Am I missing something?

Thanks,
Paul
 
Yeah, I missed this...
Changed DATA_PIN to 1 and now it works:
Code:
#include <WS2812Serial.h>
#define USE_WS2812SERIAL
#include <FastLED.h>

#define DATA_PIN    1
#define NUM_LEDS    1
#define NUM_STRIPS  1

CRGB leds[NUM_LEDS];

void setup() {
  // FastLED.addLeds<NUM_STRIPS, WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
  FastLED.addLeds<WS2812SERIAL, DATA_PIN, BRG>(leds, NUM_LEDS);
  leds[0] = CRGB::Red;
  FastLED.show();
}

void loop() {
}

Paul
 
I have tested with this parallel output, but with this I cannot use different length strips witch is my case. With teensy 3.6 Ive used as this:

#include <FastLED.h>
#define NUM_LEDS 121
#define BRIGHTNESS p

CRGB leds1[NUM_LEDS];
CRGB leds2[NUM_LEDS];
................
Setup

FastLED.addLeds<WS2812,12,GRB>(leds1,21,NUM_LEDS); // one strip begins on LED 21
FastLED.addLeds<WS2812,11,GRB>(leds1,NUM_LEDS);
FastLED.addLeds<WS2812,10,GRB>(leds2,NUM_LEDS);

............

And worked, but with teensy 4.0 don't.
 
I already used Parallel Output Mode in the sketch in the original question so this as well as houtson's code didn't get me any further. :/
 
Hi FinleyOderSo, can you throw up your latest code with the changes you made, Cheers, Paul
 
Hi FinleyOderSo,
I compiled and ran the code you showed in msg #1.
The sketch runs but the walking dots do not walk smoothly and you see regularly other LEDs light up very shortly. A full cycle/loop takes ~23 secs.
Adding #define FASTLED_ALLOW_INTERRUPTS 0 at the top of the sketch makes the whole sketch run faster(~18 secs for a cycle) and the occasional flickering of other LEDs disappeared but the walking dots are still moving jerky.
My 144-LED strip is externally powered by a 5V/7A powersupply. And a levelshifter is used ofcourse.

Paul
 
Looking further into the jerkiness of the walking dot, I shot a short video at 60fps and played it frame-by-frame using PotPlayer. Use 'D' key [backward 1 frame] or 'F' key [forward 1 frame].
You can find the video and the code here.
Now things get interesting: the walking LED is sometimes skipping a dot forward or jumping back a dot...
Definitely something goes wrong here: perhaps not the output timing but the way the array is read out?

Paul
 
So,
fortunately I got the code working now with the WS2812BSerial library Houtson suggested and the walking dot now is much less jerky. I also got "FASTLED_ALLOW_INTERRUPTS 0" working with Paul's guideline.

So this is my current code:
Code:
#define FASTLED_ALLOW_INTERRUPTS 0
#include <WS2812Serial.h>  // leds
#define USE_WS2812SERIAL  // leds
#include <FastLED.h>      // leds

#define DATA_PIN  1  // it is critical that you use this pin number or other pin numbers using FastLED's Parallel Output procedure
int brightness = 40;

// Teensy 4.0 Stuff ================
#define NUM_LEDS_PER_STRIP 144
#define NUM_STRIPS 1
#define NUM_LEDS   NUM_LEDS_PER_STRIP  
CRGB leds[NUM_LEDS_PER_STRIP * NUM_STRIPS];

void setup() { 
  delay(1000);
  // Teensy 4.0 Stuff ==============
    //FastLED.addLeds<NUM_STRIPS, WS2812B,DATA_PIN,GRB>(leds, NUM_LEDS_PER_STRIP);
    FastLED.addLeds<WS2812SERIAL, DATA_PIN, BRG>(leds, NUM_LEDS);
  //USE for WS2811:      
 // FastLED.addLeds<NUM_STRIPS, WS2811, DATA_PIN >(leds, NUM_LEDS_PER_STRIP);
  FastLED.setBrightness(brightness);
  FastLED.setMaxPowerInVoltsAndMilliamps(5, 1500);
   set_max_power_indicator_LED(13);
  fill_solid(leds, NUM_LEDS, CRGB::Black);
  FastLED.show();
 
}
void loop() {
     fill_solid( leds, NUM_LEDS, CRGB::Red);
     FastLED.delay(500);
      
     fill_solid( leds, NUM_LEDS, CRGB::Black);
     FastLED.delay(500);
    
     fill_solid( leds, NUM_LEDS, CRGB::Blue);
     FastLED.delay(500);
      
     fill_solid( leds, NUM_LEDS, CRGB::Black);
     FastLED.delay(500);
       
     fill_solid( leds, NUM_LEDS, CRGB::Yellow);
     FastLED.delay(500);
      
     fill_solid( leds, NUM_LEDS, CRGB::Black);
     FastLED.delay(500);

     cd77_colorwipe_dot(CRGB::Red, 0, NUM_LEDS, 40);
     cd77_colorwipe_dot(CRGB::Blue, 0, NUM_LEDS, 40);
     cd77_colorwipe_dot(CRGB::Green, 0, NUM_LEDS, 40);
}

void cd77_colorwipe_dot(CRGB color,uint16_t from,  uint16_t to,  uint16_t wait) {
  for (uint16_t i = from; i <to; i++) {
    leds[i] = color;
    FastLED.delay(wait);
    leds[i] = CRGB::Black;
    FastLED.show();
  }
}

The problem is still that fill_solid as well as for-looping through all leds only fills about half of them.
 
Status
Not open for further replies.
Back
Top