Which pins to use for AudioInputI2S2 on Teensy 4.0

Status
Not open for further replies.

msudogs1200

New member
I've been working on a project for school. Right now, I am just trying to get I2S2 inputs to play through the audio shield. I was wondering what pins to use for I2S2 input (do I need to initialize certain pins) and if this code should let audio flow.


#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

// GUItool: begin automatically generated code
AudioInputI2S2 i2s2_1; //xy=445,317
AudioOutputI2S i2s1; //xy=814.9333190917969,317.9333267211914
AudioConnection patchCord1(i2s2_1, 0, i2s1, 0);
AudioConnection patchCord2(i2s2_1, 1, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=552.933349609375,540.9334106445312
// GUItool: end automatically generated code

const int myInput = AUDIO_INPUT_LINEIN;

void setup() {
AudioMemory(12);
sgtl5000_1.enable();
sgtl5000_1.inputSelect(myInput);
sgtl5000_1.volume(0.7);
}

void loop() {

// do nothing while playing...
}
 
For the audio shield (rev D) you should use AudioInputI2S, not AudioInputI2S2.

As with all the audio library features, detailed documentation is in the design tool's right-side panel.

https://www.pjrc.com/teensy/gui/?info=AudioInputI2S2

Scroll down to "Hardware" for the info about which pins to connect.

You might also check on this 31 page tutorial which covers most of the audio library features.

https://www.pjrc.com/store/audio_tutorial_kit.html

All the code used in that tutorial can be accessed from File > Examples > Audio > Tutorial.

And to answer your original question, yet, that code looks like it should be able to pass audio from input to output. But it will use the wrong pins for the audio shield. To use the correct pins, just remove the "2" from both input and output.
 
Status
Not open for further replies.
Back
Top