Help using serial communication to control a 32x32 WS2812B matrix

Evening all,

I am building a 32x32 matrix consisting of the WS2812B LED’s. I have everything but the software side of things figured out. I though I did, but when I started putting things together, I was wrong. I ordered a DUE first to use that as it has a lot of SRAM and I read somewhere using the FastLED library uses 3 bytes of ram per LED and my UNO would not suffice for this project. My goal is to use the software Glediator ( to control the matrix. They do provide a sketch for “all” arduino boards but does not work on my Due. Okay. Not a big deal. I ordered a Mega. Same issue. Not getting it to work even though it is said to work. I get this error when I try to upload it to my Mega:

C:\Users\Grim\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.17\cores\arduino\main.cpp: In function 'main':

WS2812_Glediator:156: error: impossible constraint in 'asm'



lto-wrapper: C:\Users\Grim\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.3-arduino2/bin/avr-gcc returned 1 exit status

c:/users/grim/appdata/local/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ld.exe: lto-wrapper failed

collect2.exe: error: ld returned 1 exit status

exit status 1
impossible constraint in 'asm'

However, I accidentally uploaded a sketch for a different LED matrix controlling software ( and didn’t realize it but it semi-works with Glediator. The LED’s light up but they do not light up properly and just spam random colors and random patters. I’ve also posted on the Arduino Reddit and someone suggested wrote the sketch provided by Glediator and translated it from assembly to the Arduino language and it uploads fine and the COM port opens fine but the LED’s do not light up at all. Here is that sketch:

#include <FastLED.h>

const uint8_t DATA_PIN = 6;
const size_t  NUM_LEDS = 32*32;


void setup() {
  FastLED.addLeds<WS2812, DATA_PIN, GRB>(leds, NUM_LEDS);

void loop() {
  if ( == 1) {
    for (CRGB &led : leds) {
      while (Serial.available() < 3) continue;

      led.r =;
      led.g =;
      led.b =;

All help is appreciated and would love to use the Due as it has more horsepower and resources. I have been told a teensy would work as well. I have more experience with Arduino and would prefer to use it over a teensy. I apologize if this belongs in the LED section. I think it could’ve been posted in either section. Thank you community.

Well, that's why asm code is bad - it's not portable to different Arduinos, even between an UNO and a MEGA.

Don't be afraid to use a Teensy. Once you download and install the package on top of Arduino, it behaves exactly like an Arduino except better. For a start, you aren't forced to find and close the serial monitor in order to upload code.

There's people using the Teensies to run large video screens on those LEDs so they definitely have the capacity to do it.

As for that sketch, it does have some fundamental problems. I'm not sure what the format is that it's expecting from the master. It looks like it's waiting for a 1 (that's 0x01 not the character '1') and then it needs all the LED colors supplied in groups of 3 bytes. If that is the case, just delete the word "continue" from the program. Leave the semicolon. That will force it to wait for 3 bytes to arrive before issuing the colour commands to the next LED in the chain.

I'm not sure about the for() line however. That doesn't look like a normal C for loop.