Teensy 3 OctoWS2811 code for Glediator led matrix software

Here is a simple working example sketch for using Glediator with OctoWS2811 library, and some guidance on setting up.

To get Glediator running, you need to install two files that allow java applications to communicate via the computers ports. The two files you need are:
librxtxSerial.jnilib and RXTXcomm.jar

you can download these files from the RXTX site, and also find further help on installing, although I did not find the help so helpful.

The download page is here: http://rxtx.qbang.org/wiki/index.php/Download

The two files need to go into a folder called Library. For some reason, i did not have a folder, so had to create one.
If you don’t have it already, create folders in the library folder and call it /Java/Extensions.
in my mac file structure this is put under /Users/Home/Library

Glediator library extension location
into this folder put the two files

for linux there is info on this link http://rxtx.qbang.org/wiki/index.php…ation_on_Linux
but unfortunately I don’t use it, so I have this example running on MacBook Pro.

Upload the sketch below to your Teensy.


const int ledsPerStrip = 34;
const int NUM_LEDS =272;

DMAMEM int displayMemory[ledsPerStrip*6];
int drawingMemory[ledsPerStrip*6];

const int config = WS2811_GRB | WS2811_800kHz;
OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config);

void setup() {
int serialGlediator() {
while (!Serial.available()) {}
return Serial.read();
byte r,g,b;
int i;

void loop()
while (serialGlediator() != 1) {}

for (i=0; i < NUM_LEDS; i++) { b = serialGlediator(); r = serialGlediator(); g = serialGlediator(); leds.setPixel(i, Color(r,g,b)); } leds.show(); } /* Helper functions */ // Create a 24 bit color value from R,G,B unsigned int Color(byte r, byte g, byte b) { //Take the lowest 8 bits of each value and append them end to end return( ((unsigned int)b & 0xFF )<<16 | ((unsigned int)r & 0xFF)<<8 | (unsigned int)g & 0xFF);}

Gladiator is a pain, in that it seems to hang and crash on my Mac if you do things in the wrong order. First you need to set the matrix size, and then set the output parameters. Also, when setting the output parameters, you can’t go back and change settings after opening the serial port, so do this last.

set the matrix size first

when restarting Glediator, in the setup menu, you should now see the list of ports. Select the tty port usbmodemxxxx or some such. and then click apply.

set the output

Ensure that you have selected the output type as Glediator protocol.