Hello everybody,
I am working on msgeq7 sketch
The given code has few patterns which are being switched by a push button, uploaded the code it works
but I am trying to eliminate the push button and just let each pattern run for 30 seconds
delay 10000*30;
I am having problems in the void loop part is somebody can help me out to write the loop for the pattern to work for 30 seconds and then go toth next one
Attaching one function
Thank you!
#include <Adafruit_NeoPixel.h>
#include <FastLED.h>
#define PIN 6
#define COLOR_ORDER GRB
#define LED_TYPE WS2812B
#define NUM_LEDS 65
#define BRIGHTNESS 100
#define SPEED .20 // Amount to increment RGB color by each cycle
#define BG 0
#define SPARKING 50
#define COOLING 55
#define FRAMES_PER_SECOND 60
#define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0]))
#define qsubd(x, b) ((x>b)?wavebright:0) // Digital unsigned subtraction macro. if result <0, then => 0. Otherwise, take on fixed value.
#define qsuba(x, b) ((x>b)?x-b:0) // Analog Unsigned subtraction macro. if result <0, then => 0
int buttonPin = 0; // momentary push button on pin 0
int oldButtonVal = 0;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);
int spectrumAvg [7] ={ 40, 45, 55, 59, 80, 70, 230};
int boost [7] = { 0, 0, 0, 0, 200, 0, 100};
const int audioOutput = A0; //data out of MSGEQ7
const int strobePin = 12; //strobe on MSGEQ7
const int resetPin = 4; //reset on MSGEQ7
int doubledSpectrumValue[13];
int avg = 0;
int raincolor =0; //starting point of rainbow
int wait = 0;//8000; //time between modes
int spectrumValue[7]; //array to hold spectrum values
int middle = strip.numPixels() / 2; //address of middle of strand
int length = strip.numPixels() / 7; //splits strand up into 7 sections (7 bands on MGSGEQ7
int eqColors [7][3] = {{255, 0, 0}, {0, 255, 0}, {0, 0, 255}, {120, 120, 0}, {0, 120, 120}, {255, 0, 255}, {255, 255, 255}};
int eqColors2 [7][3] = {{255, 0, 0}, {0, 255, 0}, {0, 0, 255}, {255, 255, 255}, {102, 0, 102}, {255, 0, 127}, {255, 128, 0}};
int intensityColors [3] = {0,0,0};
uint32_t beginTime = 0;
uint32_t endTime = 0;
int bright = 1; //select 1 thru 10
int filterValue = 115; // MSGEQ7 always spits out a number around 60, so this filters those out
int global_brightness = 96; // Sets global brightness, i.e. 64 is 1/4 brightness.
int waveSize = 10; // size 4 uses 9 lights. One in the middle, 4 on each side. (time 7 for 63 LEDs total)
//pixels used is (wave size * 2)+1)*7
int maxOverflow = 3;
// Modes
enum
{
voide set up();
void VuOne(){
readaudio();
int y=0;
for(int i=0; i<7; i++){
int intensity = map(spectrumValue*, 0, 900, 0, 9);*
_ for(int j=(lengthi); j<(length(i+1)); j++){_
_ if(intensity > (j-(lengthi))){_
//strip.setPixelColor(j, strip.Color(eqColors[0], eqColors_[1], eqColors[2]));
strip.setPixelColor(y, (Wheel(y4)));
* y++;
}
else{
strip.setPixelColor(j, strip.Color(0,0,0));
}
}
}
strip.setBrightness(100);
strip.show();
}
void VuThree(){
readaudio();
int intensity[7];
int total;
int y=0;
for(int i=0; i<7; i++){_
intensity _= map(spectrumValue, 0, 900, 0, 9);
total+= intensity;
}
for(int m=0; m<7; m++){
for(int p=0; p<intensity[m]; p++){
strip.setPixelColor(y, strip.Color(eqColors2[m][0], eqColors2[m][1], eqColors2[m][2]));
//strip.setPixelColor(y, (Wheel(y4)));
* y++;
}
}*
Thank you_