I have an Arduino setup with a pro-mini, a MSGEQ7, and a auto-gain mic. Even if I remove the audio input to the MSGEQ7 remains the same in the 890s (out of 1024). It's the same on each of two new MSGEQ7. I've checked the schematics, https://www.instructables.com/Music-Sync-Flashing-LEDs-Arduino-MSGEQ7/, multiple times and everything seems in order including components.
I'm using the #include <MD_MSGEQ7.h>
, but I've tried it without.
Any ideas?
#include <Adafruit_NeoPixel.h>
#include <MD_MSGEQ7.h>
int LEDPIN = 12;
int MODEPIN = 10;
int mode = 0;
int lastState = LOW;
int NUMPIXELS = 50;
int DATA_PIN = 1; // read from multiplexer using Analog Pin 1, MSGEQ7 pin 3
int STROBE_PIN = 2; // MSGEQ7 pin 4
int RESET_PIN = 3; // MSGEQ7 pin 7
int spectrumValue[7];
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, LEDPIN, NEO_GRB + NEO_KHZ800);
MD_MSGEQ7 MSGEQ7(RESET_PIN, STROBE_PIN, DATA_PIN);
void setup() {
Serial.begin(9600);
pinMode(MODEPIN, INPUT);
pixels.begin();
MSGEQ7.begin();
}
void loop() {
int currentState = digitalRead(MODEPIN);
if (currentState == LOW && lastState == HIGH) {
mode++;
if (mode > 2) {
mode = 0;
}
}
lastState = currentState;
MSGEQ7.read();
for (int i = 0; i < 7; i++) {
Serial.println(MSGEQ7.get(i));
}
if (mode == 0) {
for (int i = 0; i < NUMPIXELS - 1; i++) {
pixels.setPixelColor(i, pixels.Color(30, 60, 60)); // RGB
}
} else if (mode == 1) {/////////////////////////////////////////////////////////
int height = (NUMPIXELS - 1) * MSGEQ7.get(1) / 1024;
for (int i = 0; i < NUMPIXELS - 1; i++) {
if (i < height) {
pixels.setPixelColor(i, pixels.Color(60, 60, 0)); // RGB
} else {
pixels.setPixelColor(i, pixels.Color(0, 0, 0)); // RGB
}
}
} else if (mode == 2) { /////////////////////////////////////////////////////////
pixels.setPixelColor(0, pixels.Color(120 * MSGEQ7.get(5) / 1024, 0, 0)); // RGB
}
pixels.show();
}