Using a Freeduino duemilanove analog, with Arduino 1.0.2 IDE, Adafruit WaveHC library and FFT library found here: http://neuroelec.com/2011/03/fft-library-for-arduino/
I am building a replica Ghostbusters Proton Pack with lights and sound. I would like to expand its functionality to be able to use ambient sound as a source for a visualizer effect on the various lights.
However, I've run into an unusual problem.
Here is my loop():
void loop()
{
if(!equalizerMode)
{
cyclotron();
powerCell();
delay(1000/16);
}
else
{
//calcViz();
doLowFreq();
doHighFreq();
}
}
equalizerMode is a boolean that will be true when the switch to enable this visualizer mode is "on." As I haven't wired up that switch yet, I am not actually checking and thus equalizerMode is always false, meaning what should happen is the first part of that if statement should be all that ever happens. As it is posted above, it works fine. However, if I un-comment the call to calcViz() (which will take input from the microphone, run a fast fourier transform (using the FFT library, and store the result to a global byte that will be used to determine how to light the lights) nothing works. The sounds don't play and the lights freeze.
Correct me if I'm wrong, but even though the input to calcViz() is just electronic noise, that part of the program never gets touched, since equalizerMode is always false. So, what could be causing this?
I can post the entire sketch, but it's fairly large, and I'm not sure if it's relevant, but if anyone wants to see it, I'll post it.
Side Note: The lights are controlled using shift registers. I can't use Serial output to try and debug, because for some reason, even enabling the Serial output (with a Serial.begin() call) causes the light patterns to lock up. Help with this would also be appreciated, although I don't actually need to read from Serial, so it's not a big deal for me if that doesn't get fixed.
Edit: cyclotron(), powerCell(), doHighFreq(), and doLowFreq() all simply take a global byte (for the first two, it's simply a counter, the second two use the result of calcViz()), and apply that to a preset byte array to choose what byte patterns to send to the shift registers, and then send it.