
Originally Posted by
gavspav
Thanks - yeah I know Teensy can do 4000 Leds easy - just wasn't sure whether the serial stuff would work that quickly.
I'll give it a try Monday - annoyingly I stepped on my OctoWs2811 adaptor and snapped the usb port off the teensy I'd soldered to it! Doh! New one not here till Monday. I don't think I can unsolder it. Maybe I'll connect another Teensy with some jumpers.
Ok I've tried it and I'm having a few issues. I've got it a 192 x 22 matrix set up and I'm sending data from Jinx to Teensy.
Its working great except for the last chunk of data which is a bit scrambled.
I'm wondering if this could be because the serial data isn't being sent/read fast enough?
I've ruled out the matrix itself - the panel works if I swap the cat 6 cables around or run the octows2811 demo.
I've hacked the sketch a bit to try to minimise the amount of data I was sending. I can't remember if it made any difference but its still acting up.
I have 552 pixels on output 0,2 and 4, 460 on 1,3 and 5 ,550 on 6 and zero on the last one (if that makes any sense)
Code:
#include <OctoWS2811.h>
const int ledsPerStrip = 600;
const int NUM_LEDS =4800;
DMAMEM int displayMemory[ledsPerStrip*6];
int drawingMemory[ledsPerStrip*6];
const int config = WS2811_GRB | WS2811_800kHz;
OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config);
void setup() {
leds.begin();
leds.show();
}
int serialGlediator() {
while (!Serial.available()) {}
return Serial.read();
}
byte r,g,b;
int i,j,limit;
void loop()
{
while (serialGlediator() != 1) {}
for (j=0; j<4;j++) {
limit=(j*2)*600;
for (i=limit; i < limit+552; i++) {
b = serialGlediator();
r = serialGlediator();
g = serialGlediator();
leds.setPixel(i, Color(r/2,g/2,b/2));
}
limit=((j*2)+1)*600;
for (i=limit; i < limit+460; i++) {
b = serialGlediator();
r = serialGlediator();
g = serialGlediator();
leds.setPixel(i, Color(r/2,g/2,b/2));
}
}
for (i=3600; i < 4150; i++) {
b = serialGlediator();
r = serialGlediator();
g = serialGlediator();
leds.setPixel(i, Color(g/2,b/2,r/2));
}
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);}