PieterP:
Your post contains too little information to say anything useful. We'll need at least a schematic of your setup and the code you're using.
#include <FastLED.h>
#define LED_PIN_LEFT 3
#define LED_PIN_RIGHT 4
#define NUM_LEDS 60
#define CHIPSET WS2811
#define COLOR_ORDER GRB
CRGBArray<NUM_LEDS> ledsLeft;
CRGBArray<NUM_LEDS> ledsRight;
#define BRIGHTNESS 32
int leftChannel = 1; //analog pin
int rightChannel = 2; //analog pin
int volume = 30; //0 to 1023 - high value = lower volume
int addLedsConstant = 4 ; //how fast are LEDS added to bar
int removeLedsTimeConstant = 4; //how fast are LEDS removed from bar
int middleColorLED = 45;
int combineChannels = false; //if true channels are combined and input is only LEFT channel
int numLedsToLightLeft;
int numLedsToLightRight;
long lastRefreshTime1;
long lastRefreshTime2;
void setup() {
FastLED.addLeds<CHIPSET, LED_PIN_LEFT, COLOR_ORDER>(ledsLeft, NUM_LEDS).setCorrection( TypicalSMD5050 );
FastLED.setBrightness(BRIGHTNESS);
FastLED.addLeds<CHIPSET, LED_PIN_RIGHT, COLOR_ORDER>(ledsRight, NUM_LEDS).setCorrection( TypicalSMD5050 );
FastLED.setBrightness(BRIGHTNESS);
}
void loop() {
int ledsToLightLeft = map(analogRead(leftChannel), 0, volume, 0, NUM_LEDS);
int ledsToLightRight = map(analogRead(rightChannel), 0, volume, 0, NUM_LEDS);
if (combineChannels) {
ledsToLightRight = ledsToLightLeft;
}
if (ledsToLightLeft > numLedsToLightLeft) {
numLedsToLightLeft += addLedsConstant;
} else if (ledsToLightLeft < numLedsToLightLeft) {
if(millis() - lastRefreshTime1 >= removeLedsTimeConstant) {
lastRefreshTime1 += removeLedsTimeConstant;
numLedsToLightLeft -= 1;
}
}
if (numLedsToLightLeft < 1) {
numLedsToLightLeft = 0;
}
if (numLedsToLightLeft > NUM_LEDS) {
numLedsToLightLeft = NUM_LEDS;
}
if (ledsToLightRight > numLedsToLightRight) {
numLedsToLightRight += addLedsConstant;
} else if (ledsToLightRight < numLedsToLightRight) {
if(millis() - lastRefreshTime2 >= removeLedsTimeConstant) {
lastRefreshTime2 += removeLedsTimeConstant;
numLedsToLightRight -= 1;
}
}
if (numLedsToLightRight < 1) {
numLedsToLightRight = 0;
}
if (numLedsToLightRight > NUM_LEDS) {
numLedsToLightRight = NUM_LEDS;
}
for(int led = 0; led < numLedsToLightLeft; led++) {
if (led < middleColorLED) {
ledsLeft[led] = CRGB(map(led, 0, middleColorLED - 1, 0, 255) ,255,0);
} else {
ledsLeft[led] = CRGB(255, map(led, middleColorLED, NUM_LEDS, 255, 0),0);
}
}
for(int led = NUM_LEDS; led >= numLedsToLightLeft; led--) {
ledsLeft[led] = CRGB(0, 0, 0);
}
for(int led = 0; led < numLedsToLightRight; led++) {
if (led < middleColorLED) {
ledsRight[led] = CRGB(map(led, 0, middleColorLED - 1, 0, 255) ,255,0);
} else {
ledsRight[led] = CRGB(255, map(led, middleColorLED, NUM_LEDS, 255, 0),0);
}
}
for(int led = NUM_LEDS; led >= numLedsToLightRight; led--) {
ledsRight[led] = CRGB(0, 0, 0);
}
FastLED.show();
}
NOT MY SCHEMATIC DRAWING!!! lol
Why the headphone amplifier? Why not just use a line-level output of the amplifier or audio source?
I was using it to so i could set the gain separately, however I am happy to ditch it if you think that would be best.
"2V" is meaningless when talking about AC voltages. 2V RMS will damage your Arduino, 2Vpp or 2Vp is fine (if biased correctly).
Pieter