PaulS
Well-known member
Read about the new WS2812Serial library so gave it try on a Teensy LC using a 24-LED NeoPixel Ring.
But I can't get it to work.
Here's a photo how it physically connects:

Mounted a wire to connect pin 24 to pin 17 as suggested by Paul here.
And this is the code:
Just to be sure that the hardware was OK, I loaded the following sketch on the same hardware:
This does show a rotating rainbow on the NeoPixel ring as expected, so the hardware and wiring seems OK.
I'm using Arduino V1.8.2 & Teensyduino V1.36. Compiling of both .ino's returned no errors.
So I'm stuck now... Am I overlooking the obvious?
Thanks,
Paul
But I can't get it to work.
Here's a photo how it physically connects:

Mounted a wire to connect pin 24 to pin 17 as suggested by Paul here.
And this is the code:
Code:
// WS2812Serial BasicTest Example
// Test LEDs by turning then 7 different colors.
#include <WS2812Serial.h>
const int numled = 24;
const int pin = 24;
// Usable pins:
// Teensy LC: 1, 4, 5, 24
// Teensy 3.2: 1, 5, 8, 10, 20, 31
// Teensy 3.5: 1, 5, 8, 10, 20, 26, 32, 33, 48
// Teensy 3.6: 1, 5, 8, 10, 20, 26, 32, 33
byte drawingMemory[numled * 3]; // 3 bytes per LED
DMAMEM byte displayMemory[numled * 12]; // 12 bytes per LED
WS2812Serial leds(numled, displayMemory, drawingMemory, pin, WS2812_GRB);
#define RED 0xFF0000
#define GREEN 0x00FF00
#define BLUE 0x0000FF
#define YELLOW 0xFFFF00
#define PINK 0xFF1088
#define ORANGE 0xE05800
#define WHITE 0xFFFFFF
void setup() {
leds.begin();
}
void loop() {
// change all the LEDs in 1.5 seconds
int microsec = 1500000 / leds.numPixels();
colorWipe(RED, microsec);
colorWipe(GREEN, microsec);
colorWipe(BLUE, microsec);
colorWipe(YELLOW, microsec);
colorWipe(PINK, microsec);
colorWipe(ORANGE, microsec);
colorWipe(WHITE, microsec);
}
void colorWipe(int color, int wait) {
for (int i = 0; i < leds.numPixels(); i++) {
leds.setPixel(i, color);
leds.show();
delayMicroseconds(wait);
}
}
Just to be sure that the hardware was OK, I loaded the following sketch on the same hardware:
Code:
#include <FastLED.h>
#define DATA_PIN 24
#define NUM_LEDS 24
CRGB ring[NUM_LEDS];
void setup() {
FastLED.addLeds<NEOPIXEL, DATA_PIN>(ring, NUM_LEDS);
FastLED.setBrightness(128);
}
void loop() {
for ( int i = 0; i < 255; i++) {
fill_rainbow( ring, NUM_LEDS, i, 255/24);
FastLED.show();
FastLED.delay(10);
}
}
I'm using Arduino V1.8.2 & Teensyduino V1.36. Compiling of both .ino's returned no errors.
So I'm stuck now... Am I overlooking the obvious?
Thanks,
Paul