Hello,
I created a 44000hz 16 bit stereo wav file with audacity , then I put it on a sd card (FAT32 - windows 7)
I put the sd card in a teensy 3.6
trying the below code, the teensy is not reacheable anymore ...after a while, a message keeps repeating in the IDE
unless I comment the "SD.begin..." line
really weird, since it's taken from the official audio library example code, and the teensy is bare (not inside a system nor anything)
any help appreciated
thanks
I created a 44000hz 16 bit stereo wav file with audacity , then I put it on a sd card (FAT32 - windows 7)
I put the sd card in a teensy 3.6
trying the below code, the teensy is not reacheable anymore ...after a while, a message keeps repeating in the IDE
Code:
Error while setting serial port parameters: 38,400 N 8 1
unless I comment the "SD.begin..." line
really weird, since it's taken from the official audio library example code, and the teensy is bare (not inside a system nor anything)
any help appreciated
thanks
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
AudioPlaySdWav playWav1;
AudioOutputAnalog audioOutput;
AudioConnection patchCord1(playWav1, 0, audioOutput, 0);
AudioConnection patchCord2(playWav1, 1, audioOutput, 1);
// 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
void setup() {
Serial.begin(38400);
// Audio connections require memory to work. For more
// detailed information, see the MemoryAndCpuUsage example
AudioMemory(8);
SPI.setMOSI(SDCARD_MOSI_PIN);
SPI.setSCK(SDCARD_SCK_PIN);
Serial.println("SD.begin...");
if (!(SD.begin(SDCARD_CS_PIN))) {
// stop here, but print a message repetitively
while (1) {
Serial.println("Unable to access the SD card");
delay(500);
}
}
}
void playFile(const char *filename)
{
Serial.print("Playing file: ");
Serial.println(filename);
playWav1.play(filename);
delay(5);
while (playWav1.isPlaying()) {
}
}
void loop() {
playFile("MYFILE.WAV"); // filenames are always uppercase 8.3 format
delay(2000);
}
Last edited: