Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: teensy4 + octows2811 + fastled

  1. #1
    Senior Member
    Join Date
    Nov 2012
    Location
    Los Angeles
    Posts
    125

    teensy4 + octows2811 + fastled

    Hi all,
    Before I jump too far down this rabbit hole, wanted to ask a question of those with the brains for this. I found how to get the teensy4 and fastLED library to play nicely. And I love the idea idea of being able to define the output pins for the LEDs, but is it possible to combine the two? I have a lot of animations based on the fastLED library (hence my desire to cling on to it). There's a longer story behind this (it's been a journey starting with timing issues and longish strands with the fastLED library using a teensy 3.2), but working on a PCB that's already been manufactured and need to use pins 2,5,6,7, & 8 for LEDs, and free up the rest for other inputs and outputs.

    Just curious before I break something I shouldn't break

    Thanks,
    David

  2. #2
    Senior Member
    Join Date
    Nov 2012
    Location
    Los Angeles
    Posts
    125
    Hi again,
    OK, setting aside fastLED for now and just focusing on teensy4 and the octows2811 library. I need to limit the number of pins the octosw2811 library uses, so using the code provided in the examples folder (i.e. Teensy4_PinList.ino) I specified only the 3 pins I need (2, 5 & 6). Everything looks good on pin 2, but for pin 5 the first 2 LEDs are stuck, and on pin 6 the first 5 pins are stuck. I don't have this issues with other examples in the library (since these share 3 of the 8 octo pins). No stuck LEDs. All signal lines are shifted to 5V with 100Ohm resistors in series. All components on a custom PCB, so no issues with breadboarding/bad wires.

    I'm using the code from the example, but including it here with the mods for the pins I want to use.

    Code:
    /*  OctoWS2811 Teensy4_PinList.ino - Demonstrate use of any pins
        http://www.pjrc.com/teensy/td_libs_OctoWS2811.html
    
      With Teensy 4.x, you can use any group of pins.  You are not limited
      to only 8 fixed pins as with Teensy 3.x.  This example shows how to
      use only 4 pins, which are the 4 pins of the Octo28 shield which do
      not conflict with the Audio shield.
    
      Required Connections
      --------------------
        pin 2:  LED Strip #1
        pin 14: LED strip #2
        pin 6:  LED strip #5
        pin 5:  LED strip #8
    */
    
    #include <OctoWS2811.h>
    
    // Any group of digital pins may be used
    const int numPins = 3;
    byte pinList[numPins] = {2, 5, 6};
    
    const int ledsPerStrip = 186;
    
    // These buffers need to be large enough for all the pixels.
    // The total number of pixels is "ledsPerStrip * numPins".
    // Each pixel needs 3 bytes, so multiply by 3.  An "int" is
    // 4 bytes, so divide by 4.  The array is created using "int"
    // so the compiler will align it to 32 bit memory.
    DMAMEM int displayMemory[ledsPerStrip * numPins * 3 / 4];
    int drawingMemory[ledsPerStrip * numPins * 3 / 4];
    
    const int config = WS2811_GRB | WS2811_800kHz;
    
    OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config, numPins, pinList);
    
    void setup() {
      leds.begin();
      leds.show();
    }
    
    #define RED    0xFF0000
    #define GREEN  0x00FF00
    #define BLUE   0x0000FF
    #define YELLOW 0xFFFF00
    #define PINK   0xFF1088
    #define ORANGE 0xE05800
    #define WHITE  0xFFFFFF
    
    // Less intense...
    /*
    #define RED    0x160000
    #define GREEN  0x001600
    #define BLUE   0x000016
    #define YELLOW 0x101400
    #define PINK   0x120009
    #define ORANGE 0x100400
    #define WHITE  0x101010
    */
    
    void loop() {
      int microsec = 2000000 / leds.numPixels();  // change them all in 2 seconds
    
      // uncomment for voltage controlled speed
      // millisec = analogRead(A9) / 40;
    
      colorWipe(RED, microsec);
      colorWipe(GREEN, microsec);
      colorWipe(BLUE, microsec);
      colorWipe(YELLOW, microsec);
      colorWipe(PINK, microsec);
      colorWipe(ORANGE, microsec);
      colorWipe(WHITE, microsec);
    }
    
    void colorWipe(int color, int wait)
    {
      for (int i=0; i < leds.numPixels(); i++) {
        leds.setPixel(i, color);
        leds.show();
        delayMicroseconds(wait);
      }
    }
    Anyone else seen this or have an idea how I can troubleshoot and provide more information?

    Thank you!
    David

  3. #3
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Posts
    640
    For future reference on the thread topic, this is already supported.
    https://github.com/FastLED/FastLED/w...r-with-fastled

  4. #4
    Senior Member
    Join Date
    Nov 2012
    Location
    Los Angeles
    Posts
    125
    Hi vjmuzik,
    Not completely. Can we also specify pins on the T4 (see my OP)? If it is, it's not covered on the page you linked (which I've read many times).
    Thanks,
    David

  5. #5
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Posts
    640
    You would have to edit the class declaration file to add the pin list: https://github.com/FastLED/FastLED/b...1_controller.h
    If you wanted to expose that part to the sketch you could do that as well so it’s more configurable, I can’t test it myself or I would do the edits and make a pull request.

  6. #6
    Senior Member
    Join Date
    Nov 2012
    Location
    Los Angeles
    Posts
    125
    Got it! Let me see what I can break
    Thanks for the pointer!
    Cheers,
    David

  7. #7
    Senior Member
    Join Date
    Nov 2012
    Location
    Los Angeles
    Posts
    125
    And if anyone has any pointers on post #2 in the thread, please let me know!
    Thanks again,
    David

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •