Ignore my comment avoid. With a little help from a friend, I have it work.
Have another question though. The following is my code just for the left handle channel which is lighting up 7 bands.
#include <MSGEQ7.h>
#include <Adafruit_NeoPixel.h>
//#define A0
//#define A1
#define pinReset 27
#define pinStrobe 26
#define LEDs 140 //total number of LEDs
#define PIN 22
#define OnColor 0x0000FF // BLUE
#define OffColor 0x000000 // OFF
int SpectrumLeft[7];
int SpectrumRight[7];
int SpectrumGraphLeft[7][20];
Adafruit_NeoPixel Strip = Adafruit_NeoPixel(LEDs, PIN, NEO_GRB + NEO_KHZ800);
//#define MSGEQ7_INTERVAL ReadsPerSecond(50)
//#define MSGEQ7_SMOOTH 191 // Range: 0-255
//CMSGEQ7<MSGEQ7_SMOOTH, pinReset, pinStrobe, pinAnalogleft> MSGEQ7;
// Choose a PWM pin!
#define pinLed 22
void setup()
{
Serial.begin(9600);
//pinMode(pinAnalogleft, INPUT);
pinMode(pinStrobe, OUTPUT);
pinMode(pinReset, OUTPUT);
//analogReference(DEFAULT);
digitalWrite(pinStrobe,LOW);
digitalWrite(pinReset,HIGH);
digitalWrite(pinStrobe,HIGH);
digitalWrite(pinStrobe,LOW); //Strobe pin on the shield (go to next Band)
digitalWrite(pinReset,LOW);
// Assign pixels to graph array
for (byte bar = 0 ; bar < 7 ; bar++)
{
for (byte pixel = 0 ; pixel < 20 ; pixel ++)
{
SpectrumGraphLeft[bar][pixel] = (bar * 20) + pixel;
} // end for
} // end for
Strip.begin();
Strip.show(); // Initialize all pixels to 'off'
}
void loop()
{
readSpectrum(); // Get values from spectrum shield
mapSpectrum(); // Color pixels according to spectrum values
//delay(30);
}
void readSpectrum()
{
// Band 0 = Lowest Frequencies.
byte Band;
for(Band=0;Band <7; Band++)
{
SpectrumLeft[Band] = analogRead(A0); //left
//SpectrumRight[Band] = analogRead(1); //right
digitalWrite(pinStrobe,HIGH);
digitalWrite(pinStrobe,LOW);
}
}
void mapSpectrum() // map spectrum to pixel strips
{
for(byte Band=0 ; Band <7 ; Band++)
{ // remap the analogRead values to fit our 30-pixel segments/'bars'
SpectrumLeft[Band] = map(SpectrumLeft[Band], 0, 1023, 0, 19);
for (byte Pixel = 0 ; Pixel < SpectrumLeft[Band] ; Pixel++)
{ // Turn appropriate pixels ON!
Strip.setPixelColor(SpectrumGraphLeft[Band][Pixel], OnColor);
} // end for (Pixel
for (byte Pixel = SpectrumLeft[Band] ; Pixel < 20 ; Pixel++)
{ // Turn the rest OFF!
Strip.setPixelColor(SpectrumGraphLeft[Band][Pixel], OffColor);
} // end for (Pixel
} // end for (Band
Strip.show();
} // end mapSpectrum()
How do I code to have certain individual LEDs a certain colors? Lets say I want to make the first 5 LEDs on my first band a dark color and as I go up by 5, it turns into a more lighter and brighter color. Confused here.
Also, since I flipped every other strip, how do I "flip" my code so my LEDs are moving upwards in the same direction.
Thanks!
Eddie