Hello all, I am a new member here currently working on this LED project with 8 strands of about 64 WS2812b LEDs by using a Teensy 3.5.
I read on the FastLED 3.1 Github wiki (https://github.com/FastLED/FastLED/wiki/Parallel-Output) that if i am using a Teensy 3/3.1, I could use FastLED 3.1's OctoWS2811 Controller for a faster drawing buffer than using setPixel and hence decided to try this option. May I know if it is possible to implement the code if I am using Teensy 3.5 rather than Teensy 3/3.1? I have tested the example code (examples/Multiple/OctoWS2811Demo) and it seems to work on Teensy 3.5 just fine.
Thus I decided to continue using Teensy 3.5 but i have been greeted with a troublesome issue while trying to implement customized CRGB colors. I first discovered that the WS2812b LED strips are not producing the correct colors that I defined. I proceeded to further test the LED colors by giving simple CRGB colors and found out that the LED strips are not giving me the correct colors when I power them up with the appropriate 5V power supply. For example, calling LEDS = setRGB(255, 0, 0) gives me a Green LED color instead of RED. I tested with CHSV colors and it failed to give me the appropriate colors as well.
I understand that one of the limitations of the OctoWS2811 library is that it uses its own functions for setting color data. However I have the impression that I can customize the colors through using the prepping the colors in FastLED and pushing them using its OctoWS2811 Controller. Do correct me if i am wrong.
My source code is given below. I apologize for the length.. I have commented the parts that can be ignored.
I read on the FastLED 3.1 Github wiki (https://github.com/FastLED/FastLED/wiki/Parallel-Output) that if i am using a Teensy 3/3.1, I could use FastLED 3.1's OctoWS2811 Controller for a faster drawing buffer than using setPixel and hence decided to try this option. May I know if it is possible to implement the code if I am using Teensy 3.5 rather than Teensy 3/3.1? I have tested the example code (examples/Multiple/OctoWS2811Demo) and it seems to work on Teensy 3.5 just fine.
Thus I decided to continue using Teensy 3.5 but i have been greeted with a troublesome issue while trying to implement customized CRGB colors. I first discovered that the WS2812b LED strips are not producing the correct colors that I defined. I proceeded to further test the LED colors by giving simple CRGB colors and found out that the LED strips are not giving me the correct colors when I power them up with the appropriate 5V power supply. For example, calling LEDS = setRGB(255, 0, 0) gives me a Green LED color instead of RED. I tested with CHSV colors and it failed to give me the appropriate colors as well.
I understand that one of the limitations of the OctoWS2811 library is that it uses its own functions for setting color data. However I have the impression that I can customize the colors through using the prepping the colors in FastLED and pushing them using its OctoWS2811 Controller. Do correct me if i am wrong.
My source code is given below. I apologize for the length.. I have commented the parts that can be ignored.
Code:
//________________________________________________INITIALISATION START_________________________________________
#define USE_OCTOWS2811
#include <OctoWS2811.h>
#include <FastLED.h>
#define NUM_LEDS 64
#define NUM_STRIPS 8
CRGB leds[NUM_STRIPS * NUM_LEDS];
int i;
int j;
//________________________________________________INITIALISATION END___________________________________________
/*................ FastLed Library inclusion for |Sin(x)| ............*/ // IGNORE. Not used in the test
LIB8STATIC uint16_t beatmodsin16(accum88 beats_per_minute, uint8_t lowest = 0, uint8_t highest = 222, uint32_t timebase = 0, uint8_t phase_offset = 0) {
uint8_t beat = abs(beat8(beats_per_minute, timebase));
uint8_t beatsin = (beat + phase_offset);
uint8_t rangewidth = highest - lowest;
uint8_t scaledbeat = scale8(beatsin, rangewidth);
uint8_t result = lowest + scaledbeat;
return result;
}
/*................. Fast Led Library inclusion for -|Sin(x)| ..........*/
LIB8STATIC uint16_t beatinvmodsin16(accum88 beats_per_minute, uint8_t lowest = 0, uint8_t highest = 222, uint32_t timebase = 0, uint8_t phase_offset = 0) {
uint8_t beat = -1 * abs(beat8(beats_per_minute, timebase));
uint8_t beatsin = (beat + phase_offset);
uint8_t rangewidth = highest - lowest;
uint8_t scaledbeat = scale8(beatsin, rangewidth);
uint8_t result = lowest + scaledbeat;
return result;
}
//__________________________________________________COLORS________________________________________________
CRGB emerald(59, 255, 189);
CRGB lime(103, 246, 222);
CRGB citrus(0, 251, 251);
CRGB wintergreen(164, 255, 90);
CRGB aqua(141, 248, 114);
CRGB mint(176, 248, 124);
CRGB turquoise(218, 248, 107);
CRGB skyblue(255, 250, 138);
CRGB oceanblue(246, 160, 22);
CRGB lemon(72, 204, 255);
CRGB lavender(255, 159, 164);
CRGB periwinkle(255, 72, 136);
CRGB lilac(255, 102, 218);
CRGB sweetpink(192, 186, 251);
CRGB fuschia(210, 7, 233);
CRGB bubblegum(170, 134, 243);
CRGB strawberry(132, 46, 243);
CRGB coral(80, 129, 255);
CRGB ember(3, 127, 251);
CRGB mango(3, 152, 251);
CRGB gold(3, 218, 251);
CRGB blood(0, 0, 255);
CRGB yellow(0, 255, 255);
CRGB amber(32, 165, 218);
//____________________________________________________COLORS END___________________________________________
void setup() {
LEDS.addLeds<OCTOWS2811>(leds, NUM_LEDS);
LEDS.setBrightness(50);
}
void loop() {
CRGB* color = setColor(1);
comet(1, 1500, color);
comet(1, 1500, color);
LEDS.show();
LEDS.delay(10);
}
/*................LED Pattern 6 ..........................*/
bool comet(int dir, int rate, CRGB* color)
{
if (dir == 1) {
for (i = 0 ; i < NUM_STRIPS; i++) {
for (j = 0; j < NUM_LEDS; j++) {
// leds[(i*NUM_LEDS) + j].fadeToBlackBy(1);
leds[(i*NUM_LEDS) + j] = CRGB(255, 0, 0); // TEST FOR CUSTOM COLORS. Commented the code that gives the pattern
}
// int pos = beatmodsin16(rate, 0, NUM_LEDS);
// leds[(i*NUM_LEDS) + pos] = * color;
}
}
if (dir == -1) { // IGNORE. Not used in the test.
for (i = 0 ; i < NUM_STRIPS; i++) {
for (j = 0; j < NUM_LEDS; j++) {
// leds[(i*NUM_LEDS) + j].fadeToBlackBy(1);
leds[(i*NUM_LEDS) + j].setRGB(141, 248, 114);
}
// int pos = beatinvmodsin16(rate, 0, NUM_LEDS);
// leds[(i*NUM_LEDS) + pos].setRGB(255, 250, 138);
}
}
}
// ON A NEW ARDUINO TAB
* setColor(int color_select) {
switch (color_select) {
case 1:
return &emerald;
break;
case 2:
// statements
return &lime;
break;
case 3:
// statements
return &citrus;
break;
case 4:
// statements
return &wintergreen;
break;
case 5:
// statements
return &aqua;
break;
case 6:
// statements
return &mint;
break;
case 7:
// statements
return &turquoise;
break;
case 8:
// statements
return &skyblue;
break;
case 9:
// statements
return &oceanblue;
break;
case 10:
return &lemon;
break;
case 11:
return &lavender;
break;
case 12:
return &periwinkle;
break;
case 13:
return &lilac;
break;
case 14:
return &sweetpink;
break;
case 15:
return &fuschia;
break;
case 16:
return &bubblegum;
break;
case 17:
return &strawberry;
break;
case 18:
return &coral;
break;
case 19:
return &ember;
break;
case 20:
return &mango;
break;
case 21:
return &gold;
break;
case 22:
return &blood;
break;
case 23:
return &yellow;
break;
default:
return &amber;
break;
}
}