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

Thread: Teensy LC / XINPUT and Neopixel strips

  1. #1
    Junior Member
    Join Date
    Jan 2019
    Posts
    7

    Teensy LC / XINPUT and Neopixel strips

    Hi everyone, I got some issues with a current project that I would like to run by you all to understand what my best option would be.

    I currently have one Teensy LC in XINPUT mode. It acts more or less like an Xbox controller with some extras. Now for the project I'm working on I'd like to pimp it with some led strips and I'm using Pauls Non-Blocking WS2812Serial library. This works fine in my separate test project (serial) but doesn't work after integration with the XINPUT project. Is this because of the USB mode?

    I'm using pin 24 for the neopixel btw. And I know I'm running on 3.3V but I'm having 16 leds only and from my tests it works perfectly fine (except in the XINPUT project).

    And finally, as a result of the USB mode I'm having issues debugging this. Should I get an additional USB-Serial (FTDI TTL) cable for this?

  2. #2
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    2,861
    With the LC, you might running out of memory with the combined XINPUT and with the LED processing (8K). In addition to static memory, you have to worry about how much stack and heap memory you are using.

    Since pin 24 is an alternate pin for Serial1 TX on the LC, I assume you are not using Serial1 in your program? If you were using it, the two uses would probably conflict.

  3. #3
    Junior Member
    Join Date
    Jan 2019
    Posts
    7
    Quote Originally Posted by MichaelMeissner View Post
    With the LC, you might running out of memory with the combined XINPUT and with the LED processing (8K). In addition to static memory, you have to worry about how much stack and heap memory you are using.

    Since pin 24 is an alternate pin for Serial1 TX on the LC, I assume you are not using Serial1 in your program? If you were using it, the two uses would probably conflict.
    How would I get a good measurement on used memory?

    The rest of the setup looks like this:

    https://d2rormqr1qwzpz.cloudfront.ne...ensypinout.png

    I should say that I'm not actively using pin 1 when debugging.

    What options do I have here? Should I put the LED processing on a separate teensy and instead communicate between them? For what it's worth I need to signal to the LED library every time a certain key is pressed.
    Last edited by sebrk; 01-13-2019 at 03:48 PM.

  4. #4
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    2,861
    I haven't used the WS2812Serial library, but I would guess using pins 0/1 are interfering with the WS2812Serial library. I would say try to move Joystick left/right to pins 23 and 21.

    Alternatively, if you have a small number of WS2812B leds, you can probably use the blocking version without problem, using one of your few unused pins. Without re-wiring things, you could try using pin 24 with the standard Adafruit_Neopixel library.

    Or alternatively, move your LED-2 to pin 21 or 23, and use pin 17 via the back row pin for WS2812Bs (hooking up VIN as the power pin). The advantage of using this pin is you don't have to make sure your WS2812B leds can work with 3.3v.

    Or if you are just wanting mono LEDs, you could use an i2c LED driver like MCP23017 that would allow you to create 16 LEDs of on one i2c device.

    I've not used it, but the Adafruit seesaw devices allow for off-loading various devices including up to 340 ws2812B pixels to a single i2c device:


    I've seen there is a way to tell how much heap you have allocated on the Teensy, but I don't have a copy of the location.

  5. #5
    Junior Member
    Join Date
    Jan 2019
    Posts
    7
    I have another Teensy laying around so I could use that if I manage to message that unit a simple signal. Would that be a way forward? If so, where do I start?

  6. #6
    Junior Member
    Join Date
    Jan 2019
    Posts
    7
    I've been reading up a bit and it seems using I2C would suffice. The data is not at all time sensitive and the pins are free. I think I will go with I2C and simply add the second teensy to control the leds. That way I can also use pin 17 and get the 5V. Any objections to this?

Posting Permissions

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