I know I posted this in another thread but I think this belongs here and I'd like to clear a few things up. TLDR = the "AudioConnection" line of code screws with my LED strip. Any help is very very much appreciated!
All I'm using is a Teensy 3.2, a 300 LED WS2812b strip, and the audio adapter. I only want the audio adapter to take inputs from either the Mic or Line In, and do FFT. Currently, I have the LED strip working perfectly when I'm not using the audio adapter, and the audio adapter working perfectly when I'm not using the LED strip. As you can imagine, I'd like to have them working together and I know a ton of other people have done this, which is quite frustrating to be honest.
WIRING
The audio adapter isn't stacked on the Teensy, but I have these wires connected (through a breadboard) since I only need Line In, Mic, and FFT working: 3.3V, LRCLK, SDA, SCL, RX, MCLK, BCLK, GND.
This is my wiring of an SN74HCT245N chip except I do not have a capacitor across the 5V and COM pins. LINK TO CHIP ON DIGI-KEY
CODE
BONUS CODE: I Tried the FFT tutorial example and the same thing happens. The problem seems to be the "AudioConnection" line of code. When it is commented out, the LED strip shows a rainbow. When it is not commented out, the first 50 or so LEDs in the strip flicker a bright white with the rest of the strip showing a rainbow.
All I'm using is a Teensy 3.2, a 300 LED WS2812b strip, and the audio adapter. I only want the audio adapter to take inputs from either the Mic or Line In, and do FFT. Currently, I have the LED strip working perfectly when I'm not using the audio adapter, and the audio adapter working perfectly when I'm not using the LED strip. As you can imagine, I'd like to have them working together and I know a ton of other people have done this, which is quite frustrating to be honest.
WIRING
The audio adapter isn't stacked on the Teensy, but I have these wires connected (through a breadboard) since I only need Line In, Mic, and FFT working: 3.3V, LRCLK, SDA, SCL, RX, MCLK, BCLK, GND.
This is my wiring of an SN74HCT245N chip except I do not have a capacitor across the 5V and COM pins. LINK TO CHIP ON DIGI-KEY
CODE
#include "FastLED.h"
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SerialFlash.h>
#include <SD.h>
#define NUM_LEDS 300
#define DATA_PIN 3
CRGB leds[NUM_LEDS];
// GUItool: begin automatically generated code
AudioInputI2S i2s1; //xy=219.1999969482422,183
AudioMixer4 mixer1; //xy=403.1999969482422,203.1999969482422
AudioAnalyzeFFT1024 fft1024; //xy=547.1999969482422,239
//AudioConnection patchCord1(i2s1, 0, mixer1, 0); // I COMMENT OUT THESE 3 LINES TO GET THE LED STRIP WORKING
//AudioConnection patchCord2(i2s1, 1, mixer1, 1); // I COMMENT OUT THESE 3 LINES TO GET THE LED STRIP WORKING
//AudioConnection patchCord3(mixer1, fft1024); // I COMMENT OUT THESE 3 LINES TO GET THE LED STRIP WORKING
AudioControlSGTL5000 audioShield; //xy=446.1999969482422,317
// GUItool: end automatically generated code
const int myInput = AUDIO_INPUT_MIC;
//const int myInput = AUDIO_INPUT_LINEIN;
void setup() {
// AUDIO STUFF
AudioMemory(12);
audioShield.enable();
audioShield.inputSelect(myInput);
// configure the mixer to equally add left & right
mixer1.gain(0, 0.5);
mixer1.gain(1, 0.5);
Serial.begin(9600);
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
LEDS.setBrightness(90);
LEDS.clear();
}
void loop() {
LEDS.clear();
for ( int i = 0; i < 299; i++) leds = CHSV(i,255,255); //DISPLAYS A RAINBOW
FastLED.show();
}
BONUS CODE: I Tried the FFT tutorial example and the same thing happens. The problem seems to be the "AudioConnection" line of code. When it is commented out, the LED strip shows a rainbow. When it is not commented out, the first 50 or so LEDs in the strip flicker a bright white with the rest of the strip showing a rainbow.
#include "FastLED.h"
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SerialFlash.h>
#include <SD.h>
#define NUM_LEDS 300
#define DATA_PIN 3
CRGB leds[NUM_LEDS];
//const int myInput = AUDIO_INPUT_MIC;
const int myInput = AUDIO_INPUT_LINEIN;
AudioInputI2S audioInput; // audio shield: mic or line-in
AudioAnalyzeFFT1024 myFFT;
//AudioConnection patchCord1(audioInput, 0, myFFT, 0); // LED STRIP WORKS WITH THIS COMMENTED OUT
AudioControlSGTL5000 audioShield;
void setup() {
// AUDIO STUFF
AudioMemory(12);
audioShield.enable();
audioShield.inputSelect(myInput);
myFFT.windowFunction(AudioWindowHanning1024);
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
LEDS.setBrightness(90);
LEDS.clear();
}
void loop() {
float n;
int i;
if (myFFT.available()) {
// each time new FFT data is available
// print it all to the Arduino Serial Monitor
Serial.print("FFT: ");
for (i=0; i<40; i++) {
n = myFFT.read(i);
if (n >= 0.01) {
Serial.print;
Serial.print(" ");
} else {
Serial.print(" - "); // don't print "0.00"
}
}
Serial.println();
}
LEDS.clear();
for ( int i = 0; i < 299; i++) leds = CHSV(i,255,255);
FastLED.show();
}