IFD:EAI SoS21/course material/Session 6: Getting Started with Teensyduino: Difference between revisions

From Medien Wiki
No edit summary
No edit summary
Line 10: Line 10:
#*# from "output" add "i2s"
#*# from "output" add "i2s"
#*# from "control" add "sgtl5000" [[File:teensy_webinterface.png|thumb|690px|Audio System Design Tool "Audio through patch"]]
#*# from "control" add "sgtl5000" [[File:teensy_webinterface.png|thumb|690px|Audio System Design Tool "Audio through patch"]]
# Click the export button to generate the setup code for your teensy and paste it in your Arduino IDE patch, just before the setup routine!
# Click the export button to generate the setup code for your teensy and paste it in your Arduino IDE patch, just before the setup routine! You should get output similar to the following block, paste it at the beginning of your patch.
<syntaxhighlight lang="c++">
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
 
// GUItool: begin automatically generated code
AudioInputI2S            i2s1;          //xy=200,69
AudioOutputI2S          i2s2;          //xy=365,94
AudioConnection          patchCord1(i2s1, 0, i2s2, 0);
AudioConnection          patchCord2(i2s1, 1, i2s2, 1);
AudioControlSGTL5000    sgtl5000_1;    //xy=302,184
// GUItool: end automatically generated code
</syntaxhighlight>
# In the setup routine of the arduino IDE you need code to choose the microphone port and audio levels. It should look more or less like this:<syntaxhighlight lang="c++">
# In the setup routine of the arduino IDE you need code to choose the microphone port and audio levels. It should look more or less like this:<syntaxhighlight lang="c++">
void setup() {
void setup() {