| // | // | ||||
| 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"); |
| 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); |
| #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 { |
| 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); | ||||
| 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"); |
| 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); |
| 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); |
| 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); |
| // 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); |
| // 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); |
| // 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); |
| // 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); |
| // 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); |
| 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); |
| 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); |
| 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 |