@@ -26,6 +26,23 @@ AudioConnection patchCord4(right_BitCrusher, 0, headphones, 1); | |||
// | |||
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 button0 = Bounce(0, 5); // cycles the bitcrusher through all bitdepths | |||
@@ -66,9 +83,9 @@ void setup() { | |||
// sound can play simultaneously without clipping | |||
//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 | |||
while (1) { | |||
Serial.println("Unable to access the SD card"); |
@@ -24,11 +24,21 @@ AudioConnection patchCord4(playSdWav2, 1, audioOutput, 3); | |||
AudioControlSGTL5000 sgtl5000_1; | |||
AudioControlSGTL5000 sgtl5000_2; | |||
// Use these with the audio adaptor board | |||
// 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() { | |||
Serial.begin(9600); | |||
AudioMemory(10); |
@@ -15,6 +15,21 @@ | |||
#include <SD.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() { | |||
Sd2Card card; | |||
SdVolume volume; | |||
@@ -30,16 +45,16 @@ void setup() { | |||
while (!Serial) ; | |||
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.println("SD Card Test"); | |||
Serial.println("------------"); | |||
// 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) { | |||
Serial.println("SD card is connected :-)"); | |||
} else { | |||
@@ -70,7 +85,7 @@ void setup() { | |||
Serial.println(" Mbytes."); | |||
// 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) { | |||
Serial.println("SD library is able to access the filesystem"); | |||
} else { |
@@ -11,11 +11,21 @@ AudioConnection patchCord1(playWav1, 0, audioOutput, 0); | |||
AudioConnection patchCord2(playWav1, 1, audioOutput, 1); | |||
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_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() { | |||
Serial.begin(9600); | |||
@@ -40,6 +40,23 @@ Bounce buttonPlay = Bounce(2, 8); | |||
const int myInput = AUDIO_INPUT_LINEIN; | |||
//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 | |||
int mode = 0; // 0=stopped, 1=recording, 2=playing | |||
@@ -62,9 +79,9 @@ void setup() { | |||
sgtl5000_1.volume(0.5); | |||
// 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 | |||
while (1) { | |||
Serial.println("Unable to access the SD card"); |
@@ -20,14 +20,30 @@ AudioConnection patchCord1(playSdWav1, 0, i2s1, 0); | |||
AudioConnection patchCord2(playSdWav1, 1, i2s1, 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() { | |||
Serial.begin(9600); | |||
AudioMemory(8); | |||
sgtl5000_1.enable(); | |||
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) { | |||
Serial.println("Unable to access the SD card"); | |||
delay(500); |
@@ -23,14 +23,29 @@ AudioConnection patchCord1(playSdWav1, 0, audioOutput, 0); | |||
AudioConnection patchCord2(playSdWav1, 1, audioOutput, 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() { | |||
Serial.begin(9600); | |||
AudioMemory(8); | |||
sgtl5000_1.enable(); | |||
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) { | |||
Serial.println("Unable to access the SD card"); | |||
delay(500); |
@@ -25,14 +25,29 @@ AudioControlSGTL5000 sgtl5000_1; | |||
Bounce button0 = Bounce(0, 15); | |||
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() { | |||
Serial.begin(9600); | |||
AudioMemory(8); | |||
sgtl5000_1.enable(); | |||
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) { | |||
Serial.println("Unable to access the SD card"); | |||
delay(500); |
@@ -12,14 +12,29 @@ | |||
// 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() { | |||
Serial.begin(9600); | |||
AudioMemory(8); | |||
sgtl5000_1.enable(); | |||
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) { | |||
Serial.println("Unable to access the SD card"); | |||
delay(500); |
@@ -13,14 +13,29 @@ | |||
// 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() { | |||
Serial.begin(9600); | |||
AudioMemory(8); | |||
sgtl5000_1.enable(); | |||
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) { | |||
Serial.println("Unable to access the SD card"); | |||
delay(500); |
@@ -15,6 +15,21 @@ | |||
// 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 button0 = Bounce(0, 15); | |||
@@ -29,9 +44,9 @@ void setup() { | |||
AudioMemory(12); | |||
sgtl5000_1.enable(); | |||
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) { | |||
Serial.println("Unable to access the SD card"); | |||
delay(500); |
@@ -13,14 +13,29 @@ | |||
// 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() { | |||
Serial.begin(9600); | |||
AudioMemory(10); | |||
sgtl5000_1.enable(); | |||
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) { | |||
Serial.println("Unable to access the SD card"); | |||
delay(500); |
@@ -20,15 +20,29 @@ 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 | |||
void setup() { | |||
Serial.begin(9600); | |||
AudioMemory(10); | |||
sgtl5000_1.enable(); | |||
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) { | |||
Serial.println("Unable to access the SD card"); | |||
delay(500); |
@@ -26,6 +26,21 @@ | |||
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() { | |||
Serial.begin(9600); | |||
delay(500); | |||
@@ -40,9 +55,9 @@ void setup() { | |||
AudioMemory(10); | |||
sgtl5000_1.enable(); | |||
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) { | |||
Serial.println("Unable to access the SD card"); | |||
delay(500); |
@@ -45,6 +45,21 @@ Bounce button0 = Bounce(0, 15); | |||
Bounce button1 = Bounce(1, 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 count=1; | |||
int a1=0, a2=0, a3=0; | |||
@@ -59,8 +74,8 @@ void setup() { | |||
pinMode(1, INPUT_PULLUP); | |||
pinMode(2, INPUT_PULLUP); | |||
Serial.begin(115200); | |||
SPI.setMOSI(7); | |||
SPI.setSCK(14); | |||
SPI.setMOSI(SDCARD_MOSI_PIN); | |||
SPI.setSCK(SDCARD_SCK_PIN); | |||
sgtl5000_1.enable(); | |||
sgtl5000_1.volume(0.5); | |||
sgtl5000_1.inputSelect(AUDIO_INPUT_MIC); | |||
@@ -158,7 +173,7 @@ void loop() { | |||
mixer1.gain(0, 0); | |||
mixer2.gain(0, 0); | |||
if (sdcardinit) { | |||
if (!(SD.begin(10))) { | |||
if (!(SD.begin(SDCARD_CS_PIN))) { | |||
while (1) { | |||
Serial.println("Unable to access the SD card"); | |||
if (playsamples) sample1.play(AudioSampleNosdcard); |
@@ -40,11 +40,16 @@ AudioConnection patchCord1(playWav1, 0, audioOutput, 0); | |||
AudioConnection patchCord2(playWav1, 1, audioOutput, 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_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 |