I set up the recommended circuit for using the ADC for sampling audio and got it working perfectly with the Teensy 3.6. The code returned the expected peak values.
Then switching over to a 4.1 (with the 10k resistor changed to a 2k resistor) the peak value failed to return any data and peak.available() returns false. All of the pins are still connected to the same pins as they were for the 3.6.
I do not have the pins available to use a shield so I would like to get the ADC method working for the 4.1.
Attached is the source code.
Audio_Tester.ino
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioInputAnalog adc1; //xy=227.99999618530273,267.9999885559082
AudioAnalyzePeak peak1; //xy=461.99999237060547,264.99999618530273
AudioConnection patchCord1(adc1, peak1);
// GUItool: end automatically generated code
// GUItool: end automatically generated code
long StartMillis;
void setup() {
// put your setup code here, to run once:
StartMillis = millis();
Serial.begin(9600);
delay(1000);
AudioMemory(12);
}
void loop() {
// put your main code here, to run repeatedly:
if (millis()> StartMillis+10){
StartMillis =millis();
if (peak1.available()){
float peakValue = peak1.read();
Serial.println(peakValue);
}else{
Serial.println("Peak not available");
}
}
}
Thanks in advance!