Browse Source

Update all examples to document all SD card options

dds
PaulStoffregen 8 years ago
parent
commit
a8b02e2468
16 changed files with 268 additions and 44 deletions
  1. +20
    -3
      examples/Effects/Bitcrusher/Bitcrusher.ino
  2. +11
    -1
      examples/HardwareTesting/SGTL5000/QuadChannelOutput/QuadChannelOutput.ino
  3. +20
    -5
      examples/HardwareTesting/SdCardTest/SdCardTest.ino
  4. +11
    -1
      examples/HardwareTesting/WavFilePlayerUSB/WavFilePlayerUSB.ino
  5. +20
    -3
      examples/Recorder/Recorder.ino
  6. +19
    -3
      examples/Tutorial/Part_1_03_Playing_Music/Part_1_03_Playing_Music.ino
  7. +18
    -3
      examples/Tutorial/Part_1_04_Blink_While_Playing/Part_1_04_Blink_While_Playing.ino
  8. +18
    -3
      examples/Tutorial/Part_1_05_Do_More_While_Playing/Part_1_05_Do_More_While_Playing.ino
  9. +18
    -3
      examples/Tutorial/Part_2_01_First_Design_Tool_Use/Part_2_01_First_Design_Tool_Use.ino
  10. +18
    -3
      examples/Tutorial/Part_2_02_Mixers/Part_2_02_Mixers.ino
  11. +18
    -3
      examples/Tutorial/Part_2_07_Filters/Part_2_07_Filters.ino
  12. +18
    -3
      examples/Tutorial/Part_3_01_Peak_Detection/Part_3_01_Peak_Detection.ino
  13. +17
    -3
      examples/Tutorial/Part_3_02_Fourier_Transform/Part_3_02_Fourier_Transform.ino
  14. +18
    -3
      examples/Tutorial/Part_3_03_TFT_Display/Part_3_03_TFT_Display.ino
  15. +18
    -3
      examples/Tutorial/TestTutorialKit/TestTutorialKit.ino
  16. +6
    -1
      examples/WavFilePlayer/WavFilePlayer.ino

+ 20
- 3
examples/Effects/Bitcrusher/Bitcrusher.ino View File

// //
AudioControlSGTL5000 audioShield; AudioControlSGTL5000 audioShield;



// Use these with the Teensy Audio Shield
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14

// Use these with the Teensy 3.5 & 3.6 SD card
//#define SDCARD_CS_PIN BUILTIN_SDCARD
//#define SDCARD_MOSI_PIN 11 // not actually used
//#define SDCARD_SCK_PIN 13 // not actually used

// Use these for the SD+Wiz820 or other adaptors
//#define SDCARD_CS_PIN 4
//#define SDCARD_MOSI_PIN 11
//#define SDCARD_SCK_PIN 13


// Bounce objects to read six pushbuttons (pins 0-5) // Bounce objects to read six pushbuttons (pins 0-5)
// //
Bounce button0 = Bounce(0, 5); // cycles the bitcrusher through all bitdepths Bounce button0 = Bounce(0, 5); // cycles the bitcrusher through all bitdepths
// sound can play simultaneously without clipping // sound can play simultaneously without clipping


//SDCard Initialise //SDCard Initialise
SPI.setMOSI(7);
SPI.setSCK(14);
if (!(SD.begin(10))) {
SPI.setMOSI(SDCARD_MOSI_PIN);
SPI.setSCK(SDCARD_SCK_PIN);
if (!(SD.begin(SDCARD_CS_PIN))) {
// stop here, but print a message repetitively // stop here, but print a message repetitively
while (1) { while (1) {
Serial.println("Unable to access the SD card"); Serial.println("Unable to access the SD card");

+ 11
- 1
examples/HardwareTesting/SGTL5000/QuadChannelOutput/QuadChannelOutput.ino View File

AudioControlSGTL5000 sgtl5000_1; AudioControlSGTL5000 sgtl5000_1;
AudioControlSGTL5000 sgtl5000_2; AudioControlSGTL5000 sgtl5000_2;


// Use these with the audio adaptor board
// Use these with the Teensy Audio Shield
#define SDCARD_CS_PIN 10 #define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7 #define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14 #define SDCARD_SCK_PIN 14


// Use these with the Teensy 3.5 & 3.6 SD card
//#define SDCARD_CS_PIN BUILTIN_SDCARD
//#define SDCARD_MOSI_PIN 11 // not actually used
//#define SDCARD_SCK_PIN 13 // not actually used

// Use these for the SD+Wiz820 or other adaptors
//#define SDCARD_CS_PIN 4
//#define SDCARD_MOSI_PIN 11
//#define SDCARD_SCK_PIN 13

void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
AudioMemory(10); AudioMemory(10);

+ 20
- 5
examples/HardwareTesting/SdCardTest/SdCardTest.ino View File

#include <SD.h> #include <SD.h>
#include <SPI.h> #include <SPI.h>


// Use these with the Teensy Audio Shield
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14

// Use these with the Teensy 3.5 & 3.6 SD card
//#define SDCARD_CS_PIN BUILTIN_SDCARD
//#define SDCARD_MOSI_PIN 11 // not actually used
//#define SDCARD_SCK_PIN 13 // not actually used

// Use these for the SD+Wiz820 or other adaptors
//#define SDCARD_CS_PIN 4
//#define SDCARD_MOSI_PIN 11
//#define SDCARD_SCK_PIN 13

void setup() { void setup() {
Sd2Card card; Sd2Card card;
SdVolume volume; SdVolume volume;
while (!Serial) ; while (!Serial) ;
delay(50); delay(50);


// Configure SPI for the audio shield pins
SPI.setMOSI(7); // Audio shield has MOSI on pin 7
SPI.setSCK(14); // Audio shield has SCK on pin 14
// Configure SPI
SPI.setMOSI(SDCARD_MOSI_PIN);
SPI.setSCK(SDCARD_SCK_PIN);


Serial.begin(9600); Serial.begin(9600);
Serial.println("SD Card Test"); Serial.println("SD Card Test");
Serial.println("------------"); Serial.println("------------");


// First, detect the card // First, detect the card
status = card.init(SPI_FULL_SPEED, 10); // Audio shield has SD card SD on pin 10
status = card.init(SPI_FULL_SPEED, SDCARD_CS_PIN);
if (status) { if (status) {
Serial.println("SD card is connected :-)"); Serial.println("SD card is connected :-)");
} else { } else {
Serial.println(" Mbytes."); Serial.println(" Mbytes.");


// Now open the SD card normally // Now open the SD card normally
status = SD.begin(10); // Audio shield has SD card CS on pin 10
status = SD.begin(SDCARD_CS_PIN);
if (status) { if (status) {
Serial.println("SD library is able to access the filesystem"); Serial.println("SD library is able to access the filesystem");
} else { } else {

+ 11
- 1
examples/HardwareTesting/WavFilePlayerUSB/WavFilePlayerUSB.ino View File

AudioConnection patchCord2(playWav1, 1, audioOutput, 1); AudioConnection patchCord2(playWav1, 1, audioOutput, 1);
AudioConnection patchCord3(playWav1, 0, dac, 0); AudioConnection patchCord3(playWav1, 0, dac, 0);


// Use these with the audio adaptor board
// Use these with the Teensy Audio Shield
#define SDCARD_CS_PIN 10 #define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7 #define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14 #define SDCARD_SCK_PIN 14


// Use these with the Teensy 3.5 & 3.6 SD card
//#define SDCARD_CS_PIN BUILTIN_SDCARD
//#define SDCARD_MOSI_PIN 11 // not actually used
//#define SDCARD_SCK_PIN 13 // not actually used

// Use these for the SD+Wiz820 or other adaptors
//#define SDCARD_CS_PIN 4
//#define SDCARD_MOSI_PIN 11
//#define SDCARD_SCK_PIN 13

void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);



+ 20
- 3
examples/Recorder/Recorder.ino View File

const int myInput = AUDIO_INPUT_LINEIN; const int myInput = AUDIO_INPUT_LINEIN;
//const int myInput = AUDIO_INPUT_MIC; //const int myInput = AUDIO_INPUT_MIC;



// Use these with the Teensy Audio Shield
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14

// Use these with the Teensy 3.5 & 3.6 SD card
//#define SDCARD_CS_PIN BUILTIN_SDCARD
//#define SDCARD_MOSI_PIN 11 // not actually used
//#define SDCARD_SCK_PIN 13 // not actually used

// Use these for the SD+Wiz820 or other adaptors
//#define SDCARD_CS_PIN 4
//#define SDCARD_MOSI_PIN 11
//#define SDCARD_SCK_PIN 13


// Remember which mode we're doing // Remember which mode we're doing
int mode = 0; // 0=stopped, 1=recording, 2=playing int mode = 0; // 0=stopped, 1=recording, 2=playing


sgtl5000_1.volume(0.5); sgtl5000_1.volume(0.5);


// Initialize the SD card // Initialize the SD card
SPI.setMOSI(7);
SPI.setSCK(14);
if (!(SD.begin(10))) {
SPI.setMOSI(SDCARD_MOSI_PIN);
SPI.setSCK(SDCARD_SCK_PIN);
if (!(SD.begin(SDCARD_CS_PIN))) {
// stop here if no SD card, but print a message // stop here if no SD card, but print a message
while (1) { while (1) {
Serial.println("Unable to access the SD card"); Serial.println("Unable to access the SD card");

+ 19
- 3
examples/Tutorial/Part_1_03_Playing_Music/Part_1_03_Playing_Music.ino View File

AudioConnection patchCord2(playSdWav1, 1, i2s1, 1); AudioConnection patchCord2(playSdWav1, 1, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; AudioControlSGTL5000 sgtl5000_1;


// Use these with the Teensy Audio Shield
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14

// Use these with the Teensy 3.5 & 3.6 SD card
//#define SDCARD_CS_PIN BUILTIN_SDCARD
//#define SDCARD_MOSI_PIN 11 // not actually used
//#define SDCARD_SCK_PIN 13 // not actually used

// Use these for the SD+Wiz820 or other adaptors
//#define SDCARD_CS_PIN 4
//#define SDCARD_MOSI_PIN 11
//#define SDCARD_SCK_PIN 13


void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
AudioMemory(8); AudioMemory(8);
sgtl5000_1.enable(); sgtl5000_1.enable();
sgtl5000_1.volume(0.5); sgtl5000_1.volume(0.5);
SPI.setMOSI(7);
SPI.setSCK(14);
if (!(SD.begin(10))) {
SPI.setMOSI(SDCARD_MOSI_PIN);
SPI.setSCK(SDCARD_SCK_PIN);
if (!(SD.begin(SDCARD_CS_PIN))) {
while (1) { while (1) {
Serial.println("Unable to access the SD card"); Serial.println("Unable to access the SD card");
delay(500); delay(500);

+ 18
- 3
examples/Tutorial/Part_1_04_Blink_While_Playing/Part_1_04_Blink_While_Playing.ino View File

AudioConnection patchCord2(playSdWav1, 1, audioOutput, 1); AudioConnection patchCord2(playSdWav1, 1, audioOutput, 1);
AudioControlSGTL5000 sgtl5000_1; AudioControlSGTL5000 sgtl5000_1;


// Use these with the Teensy Audio Shield
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14

// Use these with the Teensy 3.5 & 3.6 SD card
//#define SDCARD_CS_PIN BUILTIN_SDCARD
//#define SDCARD_MOSI_PIN 11 // not actually used
//#define SDCARD_SCK_PIN 13 // not actually used

// Use these for the SD+Wiz820 or other adaptors
//#define SDCARD_CS_PIN 4
//#define SDCARD_MOSI_PIN 11
//#define SDCARD_SCK_PIN 13

void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
AudioMemory(8); AudioMemory(8);
sgtl5000_1.enable(); sgtl5000_1.enable();
sgtl5000_1.volume(0.45); sgtl5000_1.volume(0.45);
SPI.setMOSI(7);
SPI.setSCK(14);
if (!(SD.begin(10))) {
SPI.setMOSI(SDCARD_MOSI_PIN);
SPI.setSCK(SDCARD_SCK_PIN);
if (!(SD.begin(SDCARD_CS_PIN))) {
while (1) { while (1) {
Serial.println("Unable to access the SD card"); Serial.println("Unable to access the SD card");
delay(500); delay(500);

+ 18
- 3
examples/Tutorial/Part_1_05_Do_More_While_Playing/Part_1_05_Do_More_While_Playing.ino View File

Bounce button0 = Bounce(0, 15); Bounce button0 = Bounce(0, 15);
Bounce button2 = Bounce(2, 15); // 15 = 15 ms debounce time Bounce button2 = Bounce(2, 15); // 15 = 15 ms debounce time


// Use these with the Teensy Audio Shield
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14

// Use these with the Teensy 3.5 & 3.6 SD card
//#define SDCARD_CS_PIN BUILTIN_SDCARD
//#define SDCARD_MOSI_PIN 11 // not actually used
//#define SDCARD_SCK_PIN 13 // not actually used

// Use these for the SD+Wiz820 or other adaptors
//#define SDCARD_CS_PIN 4
//#define SDCARD_MOSI_PIN 11
//#define SDCARD_SCK_PIN 13

void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
AudioMemory(8); AudioMemory(8);
sgtl5000_1.enable(); sgtl5000_1.enable();
sgtl5000_1.volume(0.5); sgtl5000_1.volume(0.5);
SPI.setMOSI(7);
SPI.setSCK(14);
if (!(SD.begin(10))) {
SPI.setMOSI(SDCARD_MOSI_PIN);
SPI.setSCK(SDCARD_SCK_PIN);
if (!(SD.begin(SDCARD_SCK_PIN))) {
while (1) { while (1) {
Serial.println("Unable to access the SD card"); Serial.println("Unable to access the SD card");
delay(500); delay(500);

+ 18
- 3
examples/Tutorial/Part_2_01_First_Design_Tool_Use/Part_2_01_First_Design_Tool_Use.ino View File







// Use these with the Teensy Audio Shield
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14

// Use these with the Teensy 3.5 & 3.6 SD card
//#define SDCARD_CS_PIN BUILTIN_SDCARD
//#define SDCARD_MOSI_PIN 11 // not actually used
//#define SDCARD_SCK_PIN 13 // not actually used

// Use these for the SD+Wiz820 or other adaptors
//#define SDCARD_CS_PIN 4
//#define SDCARD_MOSI_PIN 11
//#define SDCARD_SCK_PIN 13

void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
AudioMemory(8); AudioMemory(8);
sgtl5000_1.enable(); sgtl5000_1.enable();
sgtl5000_1.volume(0.5); sgtl5000_1.volume(0.5);
SPI.setMOSI(7);
SPI.setSCK(14);
if (!(SD.begin(10))) {
SPI.setMOSI(SDCARD_MOSI_PIN);
SPI.setSCK(SDCARD_SCK_PIN);
if (!(SD.begin(SDCARD_CS_PIN))) {
while (1) { while (1) {
Serial.println("Unable to access the SD card"); Serial.println("Unable to access the SD card");
delay(500); delay(500);

+ 18
- 3
examples/Tutorial/Part_2_02_Mixers/Part_2_02_Mixers.ino View File







// Use these with the Teensy Audio Shield
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14

// Use these with the Teensy 3.5 & 3.6 SD card
//#define SDCARD_CS_PIN BUILTIN_SDCARD
//#define SDCARD_MOSI_PIN 11 // not actually used
//#define SDCARD_SCK_PIN 13 // not actually used

// Use these for the SD+Wiz820 or other adaptors
//#define SDCARD_CS_PIN 4
//#define SDCARD_MOSI_PIN 11
//#define SDCARD_SCK_PIN 13

void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
AudioMemory(8); AudioMemory(8);
sgtl5000_1.enable(); sgtl5000_1.enable();
sgtl5000_1.volume(0.5); sgtl5000_1.volume(0.5);
SPI.setMOSI(7);
SPI.setSCK(14);
if (!(SD.begin(10))) {
SPI.setMOSI(SDCARD_MOSI_PIN);
SPI.setSCK(SDCARD_SCK_PIN);
if (!(SD.begin(SDCARD_CS_PIN))) {
while (1) { while (1) {
Serial.println("Unable to access the SD card"); Serial.println("Unable to access the SD card");
delay(500); delay(500);

+ 18
- 3
examples/Tutorial/Part_2_07_Filters/Part_2_07_Filters.ino View File







// Use these with the Teensy Audio Shield
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14

// Use these with the Teensy 3.5 & 3.6 SD card
//#define SDCARD_CS_PIN BUILTIN_SDCARD
//#define SDCARD_MOSI_PIN 11 // not actually used
//#define SDCARD_SCK_PIN 13 // not actually used

// Use these for the SD+Wiz820 or other adaptors
//#define SDCARD_CS_PIN 4
//#define SDCARD_MOSI_PIN 11
//#define SDCARD_SCK_PIN 13



// Bounce objects to read pushbuttons // Bounce objects to read pushbuttons
Bounce button0 = Bounce(0, 15); Bounce button0 = Bounce(0, 15);
AudioMemory(12); AudioMemory(12);
sgtl5000_1.enable(); sgtl5000_1.enable();
sgtl5000_1.volume(0.5); sgtl5000_1.volume(0.5);
SPI.setMOSI(7);
SPI.setSCK(14);
if (!(SD.begin(10))) {
SPI.setMOSI(SDCARD_MOSI_PIN);
SPI.setSCK(SDCARD_SCK_PIN);
if (!(SD.begin(SDCARD_CS_PIN))) {
while (1) { while (1) {
Serial.println("Unable to access the SD card"); Serial.println("Unable to access the SD card");
delay(500); delay(500);

+ 18
- 3
examples/Tutorial/Part_3_01_Peak_Detection/Part_3_01_Peak_Detection.ino View File







// Use these with the Teensy Audio Shield
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14

// Use these with the Teensy 3.5 & 3.6 SD card
//#define SDCARD_CS_PIN BUILTIN_SDCARD
//#define SDCARD_MOSI_PIN 11 // not actually used
//#define SDCARD_SCK_PIN 13 // not actually used

// Use these for the SD+Wiz820 or other adaptors
//#define SDCARD_CS_PIN 4
//#define SDCARD_MOSI_PIN 11
//#define SDCARD_SCK_PIN 13

void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
AudioMemory(10); AudioMemory(10);
sgtl5000_1.enable(); sgtl5000_1.enable();
sgtl5000_1.volume(0.5); sgtl5000_1.volume(0.5);
SPI.setMOSI(7);
SPI.setSCK(14);
if (!(SD.begin(10))) {
SPI.setMOSI(SDCARD_MOSI_PIN);
SPI.setSCK(SDCARD_SCK_PIN);
if (!(SD.begin(SDCARD_CS_PIN))) {
while (1) { while (1) {
Serial.println("Unable to access the SD card"); Serial.println("Unable to access the SD card");
delay(500); delay(500);

+ 17
- 3
examples/Tutorial/Part_3_02_Fourier_Transform/Part_3_02_Fourier_Transform.ino View File







// Use these with the Teensy Audio Shield
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14

// Use these with the Teensy 3.5 & 3.6 SD card
//#define SDCARD_CS_PIN BUILTIN_SDCARD
//#define SDCARD_MOSI_PIN 11 // not actually used
//#define SDCARD_SCK_PIN 13 // not actually used

// Use these for the SD+Wiz820 or other adaptors
//#define SDCARD_CS_PIN 4
//#define SDCARD_MOSI_PIN 11
//#define SDCARD_SCK_PIN 13


void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
AudioMemory(10); AudioMemory(10);
sgtl5000_1.enable(); sgtl5000_1.enable();
sgtl5000_1.volume(0.5); sgtl5000_1.volume(0.5);
SPI.setMOSI(7);
SPI.setSCK(14);
if (!(SD.begin(10))) {
SPI.setMOSI(SDCARD_MOSI_PIN);
SPI.setSCK(SDCARD_SCK_PIN);
if (!(SD.begin(SDCARD_CS_PIN))) {
while (1) { while (1) {
Serial.println("Unable to access the SD card"); Serial.println("Unable to access the SD card");
delay(500); delay(500);

+ 18
- 3
examples/Tutorial/Part_3_03_TFT_Display/Part_3_03_TFT_Display.ino View File

ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCLK, TFT_MISO); ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCLK, TFT_MISO);




// Use these with the Teensy Audio Shield
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14

// Use these with the Teensy 3.5 & 3.6 SD card
//#define SDCARD_CS_PIN BUILTIN_SDCARD
//#define SDCARD_MOSI_PIN 11 // not actually used
//#define SDCARD_SCK_PIN 13 // not actually used

// Use these for the SD+Wiz820 or other adaptors
//#define SDCARD_CS_PIN 4
//#define SDCARD_MOSI_PIN 11
//#define SDCARD_SCK_PIN 13

void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
delay(500); delay(500);
AudioMemory(10); AudioMemory(10);
sgtl5000_1.enable(); sgtl5000_1.enable();
sgtl5000_1.volume(0.5); sgtl5000_1.volume(0.5);
SPI.setMOSI(7);
SPI.setSCK(14);
if (!(SD.begin(10))) {
SPI.setMOSI(SDCARD_MOSI_PIN);
SPI.setSCK(SDCARD_SCK_PIN);
if (!(SD.begin(SDCARD_CS_PIN))) {
while (1) { while (1) {
Serial.println("Unable to access the SD card"); Serial.println("Unable to access the SD card");
delay(500); delay(500);

+ 18
- 3
examples/Tutorial/TestTutorialKit/TestTutorialKit.ino View File

Bounce button1 = Bounce(1, 15); Bounce button1 = Bounce(1, 15);
Bounce button2 = Bounce(2, 15); Bounce button2 = Bounce(2, 15);


// Use these with the Teensy Audio Shield
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14

// Use these with the Teensy 3.5 & 3.6 SD card
//#define SDCARD_CS_PIN BUILTIN_SDCARD
//#define SDCARD_MOSI_PIN 11 // not actually used
//#define SDCARD_SCK_PIN 13 // not actually used

// Use these for the SD+Wiz820 or other adaptors
//#define SDCARD_CS_PIN 4
//#define SDCARD_MOSI_PIN 11
//#define SDCARD_SCK_PIN 13

int mode; int mode;
int count=1; int count=1;
int a1=0, a2=0, a3=0; int a1=0, a2=0, a3=0;
pinMode(1, INPUT_PULLUP); pinMode(1, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP); pinMode(2, INPUT_PULLUP);
Serial.begin(115200); Serial.begin(115200);
SPI.setMOSI(7);
SPI.setSCK(14);
SPI.setMOSI(SDCARD_MOSI_PIN);
SPI.setSCK(SDCARD_SCK_PIN);
sgtl5000_1.enable(); sgtl5000_1.enable();
sgtl5000_1.volume(0.5); sgtl5000_1.volume(0.5);
sgtl5000_1.inputSelect(AUDIO_INPUT_MIC); sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);
mixer1.gain(0, 0); mixer1.gain(0, 0);
mixer2.gain(0, 0); mixer2.gain(0, 0);
if (sdcardinit) { if (sdcardinit) {
if (!(SD.begin(10))) {
if (!(SD.begin(SDCARD_CS_PIN))) {
while (1) { while (1) {
Serial.println("Unable to access the SD card"); Serial.println("Unable to access the SD card");
if (playsamples) sample1.play(AudioSampleNosdcard); if (playsamples) sample1.play(AudioSampleNosdcard);

+ 6
- 1
examples/WavFilePlayer/WavFilePlayer.ino View File

AudioConnection patchCord2(playWav1, 1, audioOutput, 1); AudioConnection patchCord2(playWav1, 1, audioOutput, 1);
AudioControlSGTL5000 sgtl5000_1; AudioControlSGTL5000 sgtl5000_1;


// Use these with the audio adaptor board
// Use these with the Teensy Audio Shield
#define SDCARD_CS_PIN 10 #define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7 #define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14 #define SDCARD_SCK_PIN 14


// Use these with the Teensy 3.5 & 3.6 SD card
//#define SDCARD_CS_PIN BUILTIN_SDCARD
//#define SDCARD_MOSI_PIN 11 // not actually used
//#define SDCARD_SCK_PIN 13 // not actually used

// Use these for the SD+Wiz820 or other adaptors // Use these for the SD+Wiz820 or other adaptors
//#define SDCARD_CS_PIN 4 //#define SDCARD_CS_PIN 4
//#define SDCARD_MOSI_PIN 11 //#define SDCARD_MOSI_PIN 11

Loading…
Cancel
Save