Getting my Teensy 3.2 working with my WS2812b strip has been troubling me. I have the LED data signal going through a SN74HCT245N chip which is wired as shown in the picture from Pabloantxon on this page. I also have the ground pin on the Teensy connected to the ground on the LED strip. The Teensy is getting power through the USB.
This is where I think the problem is, but I don't know why. The code in loop() just creates a rainbow. When I comment out the code automatically generated by the GUI tool and the audio code in setup(), the rainbow shows perfectly. When it is not commented out (as shown below), the first 40-50 LEDs in the strip are white with a very quick flickering.
This is where I think the problem is, but I don't know why. The code in loop() just creates a rainbow. When I comment out the code automatically generated by the GUI tool and the audio code in setup(), the rainbow shows perfectly. When it is not commented out (as shown below), the first 40-50 LEDs in the strip are white with a very quick flickering.
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include "FastLED.h"
#include "math.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);
AudioConnection patchCord2(i2s1, 1, mixer1, 1);
AudioConnection patchCord3(mixer1, fft1024);
AudioControlSGTL5000 audioShield; //xy=446.1999969482422,317
// GUItool: end automatically generated code
// TOUCHSCREEN PINS
#define CS_PIN 8
#define TIRQ_PIN 2
XPT2046_Touchscreen ts(CS_PIN, TIRQ_PIN); // Param 2 - Touch IRQ Pin - interrupt enabled polling
#define TFT_CS 21
#define TFT_DC 20
#define TFT_RST 255 // 255 = unused, connect to 3.3V
#define TFT_MOSI 7
#define TFT_SCLK 14
#define TFT_MISO 12
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCLK, TFT_MISO);
//const int myInput = AUDIO_INPUT_LINEIN;
const int myInput = AUDIO_INPUT_MIC;
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();
fill_rainbow(leds, NUM_LEDS, 0, 5);
FastLED.show();
}