PaulS
Well-known member
I'm trying to get the audio libary to work on a Teensy 3.1. I didn't buy the Audio Adapter Board [yet].
Started off with a basic program that reads the ADC port and outputs a 1024 FFT to the serial port.
Here is the code:
Compiling and downloading went OK, serial monitor is fine and a continuous "in the loop" is printed, but no FFT values are displayed.
It seems the fft1024_1.available() never becomes true. I tested analog port A2 with a simple analogRead(2) and it's working fine.
Any ideas? Am I overlooking the obvious?
Using Arduino 1.6.3, Teensy Loader 1.22, Teensy Audio Library 1.02.
Thanks for your help upfront,
Paul
Started off with a basic program that reads the ADC port and outputs a 1024 FFT to the serial port.
Here is the code:
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
// GUItool: begin automatically generated code
AudioInputAnalog adc1;
AudioAnalyzeFFT1024 fft1024_1;
AudioConnection patchCord1(adc1, fft1024_1);
// GUItool: end automatically generated code
void setup() {
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect.
}
delay(1000);
Serial.println("Serial port connected");
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
AudioMemory(12);
fft1024_1.windowFunction(AudioWindowHanning1024);
}
void loop() {
float n;
int i;
Serial.println("in the loop");
if (fft1024_1.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 = fft1024_1.read(i);
if (n >= 0.01) {
Serial.print(n);
Serial.print(" ");
} else {
Serial.print(" - "); // don't print "0.00"
}
}
Serial.println();
}
}
Compiling and downloading went OK, serial monitor is fine and a continuous "in the loop" is printed, but no FFT values are displayed.
It seems the fft1024_1.available() never becomes true. I tested analog port A2 with a simple analogRead(2) and it's working fine.
Any ideas? Am I overlooking the obvious?
Using Arduino 1.6.3, Teensy Loader 1.22, Teensy Audio Library 1.02.
Thanks for your help upfront,
Paul
Last edited:
