Teensy 3.2 and WS2812B NOT WORKING?

Status
Not open for further replies.
Can anyone help me get this code working? This code is working on the Arduino but not transitioning to the Teensy.
I am trying to illuminate 3 LEDs on the WS2812B with my Teensy 3.2.

Code:
#include <Adafruit_NeoPixel.h>

#define LED_PIN    3
#define LED_COUNT  3

Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

void colorWipe(uint32_t color, int wait) {
  for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match    
  }                    
}

void setup() {
}

void loop() {
  colorWipe(strip.Color(0,  255,   0), 0); // Green
}
 
Are you sure that works on normal Arduino? I don't see how it could, since you're missing "strip.begin();" to initialize the library.

I tested just now with a Teensy 3.2 and the missing line added.

DSC_0725_web.jpg

Here's the full code I tested:

Code:
#include <Adafruit_NeoPixel.h>

#define LED_PIN    3
#define LED_COUNT  3

Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

void colorWipe(uint32_t color, int wait) {
  for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match    
  }                    
}

void setup() {
  strip.begin();
}

void loop() {
  colorWipe(strip.Color(0,  255,   0), 0); // Green
}
 
Also consider that some WS2812 LEDs (NeoPixel) do not work with 3.3V signals.

But most newer ones do accept 3.3V, as do the very oldest ones.
 
Status
Not open for further replies.
Back
Top