IFD:EAI SoS21/course material/Session 6: Getting Started with Teensyduino: Difference between revisions
From Medien Wiki
No edit summary |
No edit summary |
||
Line 19: | Line 19: | ||
# Click the export button to generate the setup code for your teensy and paste it in your Arduino IDE patch! | # Click the export button to generate the setup code for your teensy and paste it in your Arduino IDE patch! | ||
# 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: | # 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() { | ||
// Audio connections require memory to work. For more | // Audio connections require memory to work. For more | ||
Line 31: | Line 31: | ||
sgtl5000_1.volume(0.8); // from 0.0 to 1.0 // 0.8 standard | sgtl5000_1.volume(0.8); // from 0.0 to 1.0 // 0.8 standard | ||
} | } | ||
</syntaxhighlight> | |||
# Press upload and compile the patch. | # Press upload and compile the patch. |
Revision as of 16:13, 25 May 2021
After you soldered your headers and mics, it's time to try and get some sound in and output from your teensy devices! Here is a short how-to, partially summarizing what we did in the last online session.
- Installing Arduino IDE and Teensyduino: https://www.pjrc.com/teensy/td_download.html
- Opening and programming the example patch
If you are having problems connecting your teensies :( read through the following sections:
- check out the teensy web ide patches: https://www.pjrc.com/teensy/gui/
- add the following nodes from the gui:
- from "input" add "i2s"
- from "output" add "i2s"
- from "control" add "sgtl5000"
- add the following nodes from the gui:
- Click the export button to generate the setup code for your teensy and paste it in your Arduino IDE patch!
- 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:
void setup() {
// Audio connections require memory to work. For more
// detailed information, see the MemoryAndCpuUsage example
AudioMemory(8);
// Enable the audio shield and set the output volume.
sgtl5000_1.enable();
sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);
sgtl5000_1.micGain(36); //from 0dB 40dB
sgtl5000_1.volume(0.8); // from 0.0 to 1.0 // 0.8 standard
}
- Press upload and compile the patch.