Kaynağa Gözat

Update all examples to document all SD card options

dds
PaulStoffregen 7 yıl önce
ebeveyn
işleme
a8b02e2468
16 değiştirilmiş dosya ile 268 ekleme ve 44 silme
  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 Dosyayı Görüntüle

@@ -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");

+ 11
- 1
examples/HardwareTesting/SGTL5000/QuadChannelOutput/QuadChannelOutput.ino Dosyayı Görüntüle

@@ -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);

+ 20
- 5
examples/HardwareTesting/SdCardTest/SdCardTest.ino Dosyayı Görüntüle

@@ -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
- 1
examples/HardwareTesting/WavFilePlayerUSB/WavFilePlayerUSB.ino Dosyayı Görüntüle

@@ -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);


+ 20
- 3
examples/Recorder/Recorder.ino Dosyayı Görüntüle

@@ -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");

+ 19
- 3
examples/Tutorial/Part_1_03_Playing_Music/Part_1_03_Playing_Music.ino Dosyayı Görüntüle

@@ -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);

+ 18
- 3
examples/Tutorial/Part_1_04_Blink_While_Playing/Part_1_04_Blink_While_Playing.ino Dosyayı Görüntüle

@@ -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);

+ 18
- 3
examples/Tutorial/Part_1_05_Do_More_While_Playing/Part_1_05_Do_More_While_Playing.ino Dosyayı Görüntüle

@@ -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);

+ 18
- 3
examples/Tutorial/Part_2_01_First_Design_Tool_Use/Part_2_01_First_Design_Tool_Use.ino Dosyayı Görüntüle

@@ -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);

+ 18
- 3
examples/Tutorial/Part_2_02_Mixers/Part_2_02_Mixers.ino Dosyayı Görüntüle

@@ -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);

+ 18
- 3
examples/Tutorial/Part_2_07_Filters/Part_2_07_Filters.ino Dosyayı Görüntüle

@@ -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);

+ 18
- 3
examples/Tutorial/Part_3_01_Peak_Detection/Part_3_01_Peak_Detection.ino Dosyayı Görüntüle

@@ -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);

+ 17
- 3
examples/Tutorial/Part_3_02_Fourier_Transform/Part_3_02_Fourier_Transform.ino Dosyayı Görüntüle

@@ -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);

+ 18
- 3
examples/Tutorial/Part_3_03_TFT_Display/Part_3_03_TFT_Display.ino Dosyayı Görüntüle

@@ -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);

+ 18
- 3
examples/Tutorial/TestTutorialKit/TestTutorialKit.ino Dosyayı Görüntüle

@@ -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);

+ 6
- 1
examples/WavFilePlayer/WavFilePlayer.ino Dosyayı Görüntüle

@@ -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

Yükleniyor…
İptal
Kaydet