dimitre
Well-known member
I'm experimenting with a brand new Teensy 3.5 to see which ports I can use to drive independent APA102 strips.
FastLED is not able to handle yet ports > 23 but Adafruit_Dotstar does.
I don't know if I'm doing it right but I've tried to make an array of Adafruit_DotStar, and I'm able to drive 3 different APA102 ports at the same time, maximum.
Any ideas?
FastLED is not able to handle yet ports > 23 but Adafruit_Dotstar does.
I don't know if I'm doing it right but I've tried to make an array of Adafruit_DotStar, and I'm able to drive 3 different APA102 ports at the same time, maximum.
Any ideas?
Code:
#define NUM_LEDS 72
int nPortas = 3;
typedef struct {
byte d;
byte c;
} dataClock;
dataClock ports[19] = {
{ 2, 3 },
{ 4, 5 },
// { 6, 7 },
{ 8, 9 },
//{ 10, 11 },
{ 12, 13 },
{ 14, 15 },
{ 16, 17 },
{ 18, 19 },
{ 20, 21 },
{ 22, 23 },
{ 24, 25 },
{ 26, 27 },
{ 28, 29 },
{ 30, 31 },
{ 32, 33 },
{ 34, 35 },
{ 36, 37 },
{ 38, 39 }
};
#include <Adafruit_DotStar.h>
#include <SPI.h>
Adafruit_DotStar s[3] = Adafruit_DotStar(NUM_LEDS);
//Adafruit_DotStar s[3] = Adafruit_DotStar(NUM_LEDS, DATA_PIN, CLOCK_PIN, DOTSTAR_BGR);
float contagem = 0;
void setup() {
Serial.begin(9600);
for (int a = 0; a < nPortas; a++) {
s[a].begin();
s[a].updatePins(ports[a].d, ports[a].c);
s[a].show();
s[a].setBrightness(75);
}
}
void loop() {
contagem += .2;
for (int i = 0; i < NUM_LEDS; i++) {
float alpha = constrain(sin(contagem * .1 + i * .02) * 2 + 1.0, 0, 1);
uint8_t r = sin(contagem * .5 + i * .09) * 127.0 + 127.0;
uint8_t g = sin(contagem * .6 + i * .011) * 127.0 + 127.0;
uint8_t b = sin(contagem * .7 + i * .013) * 127.0 + 127.0;
for (int a = 0; a < nPortas; a++) {
s[a].setPixelColor(i, r * alpha , g * alpha, b * alpha);
}
}
for (int a = 0; a < nPortas; a++) {
s[a].show();
}
delay(33);
}