hello fellow arduino programmers, im currently working on a LED matrix where im driving a 30x7 (210led WS2812) matrix. im usng a arduino nano for this job.
i found this part of code on the internet, but this is using the octoWS2811 library, and i like to get this working without the ws2811 octo library, as this is only for teensys.
the original code looks like this:
#include <OctoWS2811.h>
#include<OctoWS2811.h>
#include<FastLED.h>
// ------------ Change these as neccesary -----------//
#define NUM_LEDS_PER_STRIP 400
#define NUM_STRIPS 8
CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP];
const int numOfBytes = NUM_LEDS_PER_STRIP * NUM_STRIPS * 3;
const int numLeds = NUM_LEDS_PER_STRIP * NUM_STRIPS;
char inputBuffer[numOfBytes];
// ------------------- Setup -------------------- //
void setup() {
LEDS.addLeds<OCTOWS2811>(leds, NUM_LEDS_PER_STRIP);
LEDS.setBrightness(255);
delay(500);
Serial.begin(115200);
Serial.setTimeout(500);
LEDS.show();
}
// ------------------- Main Loop -------------------- //
void loop() {
if(Serial.available() > 0) {
Serial.readBytes(inputBuffer, numOfBytes);
}
for (int j = 0; j < numLeds; j++) {
leds[j] = CRGB(inputBuffer[(j*3)],inputBuffer[(j*3)+1],inputBuffer[(j*3)+2]);
}
LEDS.show();
}
and i want it to work with something like this:
#include<FastLED.h>
// ------------ Change these as neccesary -----------//
#define NUM_LEDS_PER_STRIP 400
#define NUM_STRIPS 8
CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP];
const int numOfBytes = NUM_LEDS_PER_STRIP * NUM_STRIPS * 3;
const int numLeds = NUM_LEDS_PER_STRIP * NUM_STRIPS;
char inputBuffer[numOfBytes];
// ------------------- Setup -------------------- //
void setup() {
FastLED.addLeds<NEOPIXEL, 3>(leds, 0, Num_Leds);
FastLED.addLeds<NEOPIXEL, 4>(leds, Num_Leds, Num_Leds);
FastLED.addLeds<NEOPIXEL, 5>(leds, 2 * Num_Leds, Num_Leds);
FastLED.addLeds<NEOPIXEL, 6>(leds, 3 * Num_Leds, Num_Leds); -------to let fastled know it should be seen as a single led-strip
FastLED.addLeds<NEOPIXEL, 7>(leds, 4 * Num_Leds, Num_Leds);
FastLED.addLeds<NEOPIXEL, 8>(leds, 5 * Num_Leds, Num_Leds);
FastLED.setBrightness(255);
delay(500);
Serial.begin(115200);
Serial.setTimeout(500);
FastLED.show();
}
// ------------------- Main Loop -------------------- //
void loop() {
if(Serial.available() > 0) {
Serial.readBytes(inputBuffer, numOfBytes);
}
for (int j = 0; j < numLeds; j++) {
leds[j] = CRGB(inputBuffer[(j*3)],inputBuffer[(j*3)+1],inputBuffer[(j*3)+2]);
}
FastLED.show();
}
any suggestions on this? it should be a simple streaming piece of code but i cannot figure out how to get this to compile using the fastled library and NEOPIXEL/ws2812 leds.