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

Thread: Running Audio and Neopixels at the same time with Prop Sheild

  1. #1

    Running Audio and Neopixels at the same time with Prop Sheild

    Hey there,
    I'm trying to run the audio library whilst animating neopixels, but I need some help. My setup is a teensy 3.2 with a prop shield, a 16 led neopixel ring connected to pin 8 on the teensy, and a single speaker on the prop shield amp. I'm powering the device with a sparkfun 5v/1A charger/booster board and a 2000Mah battery. Worth noting is that I have a Hc05 bluetooth unit also connected to pins 1 and 2, not sure if this effects things.

    Here's what i've tried:

    1. Adafruit neopixel library
    This works fine for lighting and animating the lights however the audio will hang when the lights are being animated. I've read this is because the adafruit library blocks interrupts or something.
    However the audio will come through fine when the lights are on a static colour.

    2. OctoWS2812 Library
    This works for lighting up the ring but no audio will come out when I have the lights running, animated or not.

    3. WS2812Serial Library
    I cant even get the lights working with this library, just using the basic example, having changed my pin number to 8 in the code and nothing happens when I run it.
    It seems that this was designed specifically for the purpose i'm after but I can't get it to work at all, any help would be appreciated.

    That's all I've got, I was only testing with the example sketches so I have no code to post.

    Cheers

  2. #2
    Hey So i figured out why the WS2812 Library wasn't working, kinda. I moved the leds to pin 1 instead of 8 and it worked. However I don't know why pin 8 wasn't working, it says it's a supported pin in the readme...

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,046
    WS2812Serial is the best choice.

    Quote Originally Posted by Waterme11on View Post
    3. WS2812Serial Library
    I cant even get the lights working with this library, just using the basic example, having changed my pin number to 8 in the code and nothing happens when I run it.
    Looks like there's a bug with pins 8 and 20.

    The simplest solution would be the use pin 1, 5, 10 or 31.

    If you really want to use pin 8, copy this file to the WS2812Serial library folder. Also set Tools > CPU Speed to 120 MHz overclock.
    Attached Files Attached Files

  4. #4
    Awesome thanks,
    Do you recommend setting the cpu speed to 120mhz for general Audio+Led use or just if I want to use pin 8?

    Also I'm using the IMU to control parameters like volume/frequency for my audio, but it's proving to be difficult in conjunction with animated leds, as most of the examples use some kind of delay.
    I was going to wait until I knew more about how led animations work before making a thread asking for help but if you could point me in the right direction for getting Audio, motion, and leds working all at once that would be amazing.

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,046
    Quote Originally Posted by Waterme11on View Post
    Do you recommend setting the cpu speed to 120mhz for general Audio+Led use or just if I want to use pin 8?
    Only if you use pins 8 or 20. Serial3 can only just barely manage the data rate.

    Serial1 and Serial2 are much more capable.

Posting Permissions

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