Skip to content

Instantly share code, notes, and snippets.

@drewandre
Last active October 17, 2018 02:49
Show Gist options
  • Save drewandre/14a6cef86befecf1c39634d6f1117b4e to your computer and use it in GitHub Desktop.
Save drewandre/14a6cef86befecf1c39634d6f1117b4e to your computer and use it in GitHub Desktop.
#include <FastLED.h>
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#define NUM_LEDS 300
#define DATA_PIN 7
#define CLOCK_PIN 14
CRGB leds[NUM_LEDS];
AudioInputI2S audioInput;
AudioOutputI2S audioOutput;
AudioAnalyzeFFT1024 fftL;
AudioAnalyzeFFT1024 fftR;
AudioConnection patchCord1(audioInput, 0, audioOutput, 0);
AudioConnection patchCord2(audioInput, 1, audioOutput, 1);
AudioConnection patchCord3(audioInput, 0, fftL, 0);
AudioConnection patchCord4(audioInput, 1, fftR, 0);
AudioControlSGTL5000 sgtl5000;
void setup() {
FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN, BRG>(leds, NUM_LEDS);
AudioMemory(20);
sgtl5000.enable();
sgtl5000.inputSelect(AUDIO_INPUT_LINEIN);
sgtl5000.volume(0.5);
fill_solid(leds, NUM_LEDS, CRGB::Black);
FastLED.show();
}
int i = 0;
void loop() {
EVERY_N_MILLISECONDS(50)
{
i++;
fill_solid(leds, NUM_LEDS, CHSV(i, 255, 255));
FastLED.show();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment