Starscream
New member
Hi guys,
I'm trying to establish a spectrum analyzer on a 16x32 RGB Led Matrix with a Teensy 3.1. I can successfuly use the matrix with the Smart Matrix Library i have got from here:
https://github.com/pixelmatix/SmartMatrix
I also can run the FFT example program from the Teensy Audio Library. The FFT data is shown well on the serial Monitor.
The issue i have is, that the Teensy seems to stop working as soon as i combine both librarys in a single sketch.
Here is my Code, it is almost exactly the Example Code from the Audio Library with the smart matrix lib added. As soon as i uncomment "matrix.begin();" i don't get any data from the Teensy it seems not to run at all, with "matrix.begin();" commented out everything works fine. I tried V1 and V2 from the Smart Matrix Lib. My Teensyduino Version is 1.20. I tried multiple Analog inputs, i'm using the Sparkfun Electet Mic Breakout.
Please let me know any guideance you might have.
I'm trying to establish a spectrum analyzer on a 16x32 RGB Led Matrix with a Teensy 3.1. I can successfuly use the matrix with the Smart Matrix Library i have got from here:
https://github.com/pixelmatix/SmartMatrix
I also can run the FFT example program from the Teensy Audio Library. The FFT data is shown well on the serial Monitor.
The issue i have is, that the Teensy seems to stop working as soon as i combine both librarys in a single sketch.
Here is my Code, it is almost exactly the Example Code from the Audio Library with the smart matrix lib added. As soon as i uncomment "matrix.begin();" i don't get any data from the Teensy it seems not to run at all, with "matrix.begin();" commented out everything works fine. I tried V1 and V2 from the Smart Matrix Lib. My Teensyduino Version is 1.20. I tried multiple Analog inputs, i'm using the Sparkfun Electet Mic Breakout.
Please let me know any guideance you might have.
Code:
// FFT Test
//
// Compute a 1024 point Fast Fourier Transform (spectrum analysis)
// on audio connected to the Left Line-In pin. By changing code,
// a synthetic sine wave can be input instead.
//
// The first 40 (of 512) frequency analysis bins are printed to
// the Arduino Serial Monitor. Viewing the raw data can help you
// understand how the FFT works and what results to expect when
// using the data to control LEDs, motors, or other fun things!
//
// This example code is in the public domain.
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include "SmartMatrix_16x32.h"
SmartMatrix matrix;
//const int myInput = AUDIO_INPUT_LINEIN;
//const int myInput = AUDIO_INPUT_MIC;
// Create the Audio components. These should be created in the
// order data flows, inputs/sources -> processing -> outputs
//
AudioAnalyzeFFT1024 myFFT;
AudioInputAnalog audioInput(A2);
AudioConnection patchCord1(audioInput, 0, myFFT, 0);
void setup() {
// Audio connections require memory to work. For more
// detailed information, see the MemoryAndCpuUsage example
AudioMemory(12);
// Configure the window algorithm to use
myFFT.windowFunction(AudioWindowHanning1024);
//myFFT.windowFunction(NULL);
//matrix.begin();
}
void loop() {
float n;
int i;
if (myFFT.available()) {
// each time new FFT data is available
// print it all to the Arduino Serial Monitor
Serial.print("FFT: ");
for (i=0; i<40; i++) {
n = myFFT.read(i);
if (n >= 0.01) {
Serial.print(n);
Serial.print(" ");
} else {
Serial.print(" - "); // don't print "0.00"
}
}
Serial.println();
}
}