1

here is what I got:

  • teensy++ 2.0 with code below
  • Glediator configured for Glediator_Protocol/Single_Pixels/HL_TL/RGB/B_1000000
  • led matrix with the PL9823 leds (80 of them)

I first off have to set the code to 160 on the teensy just to get it to at least make the leds change. even when i have it set to that OR the 80 leds, it does not show what is on screen (see video below). I have no clue what to try next.

Code

#include "FastLED.h"
#define NUM_LEDS 160
const int dataline = PIN_B4;
CRGB leds[NUM_LEDS];

void setup() 
{
    digitalWrite(6,LOW);
    Serial.begin(1000000); 
    LEDS.addLeds<WS2812B, dataline>(leds, NUM_LEDS);
    for (int p=0;p< NUM_LEDS;p++)
    {
        leds[p] = CRGB::Black;  
        FastLED.show();
    }
}

int serialReadBlocking() 
{
    while (!Serial.available()) 
    {
    }
    return Serial.read(); 
}

void loop() 
{
    while (serialReadBlocking() != 1) 
    {
    } 
    for (long i=0; i < NUM_LEDS; i++) 
    {
        leds[i].r = serialReadBlocking();
        leds[i].g = serialReadBlocking();
        leds[i].b = serialReadBlocking();
    }
    FastLED.show();
}

https://www.youtube.com/watch?v=H6OuMWKtbmo

1

G'day Guy, What you're building there looks nice. Do you have a circuit diagram you can share? Regarding the code, I've never played with FastLED.h but is the serialReadBlocking how it deals with the input data? Not that it's wrong, just not what I was expecting.

Two things to look at:

  1. Your serial baud rate is a bit odd, 1 million neat. Is that intended? I wouldn't think so. Most common is 9600, I have run projects at 19,200 for giggles, but I doubt that you have it correct there.

  2. I see your project you are using multi coloured LEDs with 3+1 pins which in actual fact means you have 240 LEDs (are the last 80 segments/colours all lighting?). If your PC sending the serial stream is expecting 80x single colour LEDs (80 individual LEDS) but you've got 80x tri-colour LEDs (80x3=240 LEDs) you probably aren't lighting them all up. (I only mention this point because I noticed your PC appeared to be sending only one colour, but that could have just been the moment I saw in the video).

edit: I meant to include this link for the teensy serial baud rate info: https://www.pjrc.com/teensy/td_uart.html

  • The teensy++2.0 uses a hardware USB built into its AT90USB1286 chip and completely ignores any baud rate set in the Serial.begin(10000000) line, using instead a 12Mbit/sec rate i. See pjrc.com/teensy/td_serial.html – Dave X Dec 13 '15 at 15:28
  • Cool, I didn't know that, thanks. I don't yet have any Teensy stuff. It is something I've wanted to play with :) – Madivad Dec 13 '15 at 21:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.