Hi all
I started today to use teensy with audio shield and I went through the workshop pdf and video.
I didn't connect the buttons and all as in the workshop but connected only the teensy to the audio shield.
I came across a problem pretty early and I don't know what to do...
I tried several audio tutorials and none of them played any sound . I tried the "blink_while_playing" tutorial to see whether I have problem with the connection between the teensy and the audio shield but there were no blinks.
I went line by line in the code to figure out where is the problematic line and I found out that the code does nothing after "using" the AudioControlSGTL5000 variable in the setup.
This is the code:
And this is the output:
Do you know what seems to be the problem?
Thanks,
Elad
I started today to use teensy with audio shield and I went through the workshop pdf and video.
I didn't connect the buttons and all as in the workshop but connected only the teensy to the audio shield.
I came across a problem pretty early and I don't know what to do...
I tried several audio tutorials and none of them played any sound . I tried the "blink_while_playing" tutorial to see whether I have problem with the connection between the teensy and the audio shield but there were no blinks.
I went line by line in the code to figure out where is the problematic line and I found out that the code does nothing after "using" the AudioControlSGTL5000 variable in the setup.
This is the code:
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
AudioPlaySdWav playSdWav1;
AudioOutputI2S audioOutput;
AudioConnection patchCord1(playSdWav1, 0, audioOutput, 0);
AudioConnection patchCord2(playSdWav1, 1, audioOutput, 1);
AudioControlSGTL5000 sgtl5000_1;
void setup() {
Serial.begin(9600);
delay(500);
Serial.println("Hello");
delay(500);
Serial.println("World");
delay(500);
AudioMemory(8);
Serial.println("Hello");
delay(500);
sgtl5000_1.enable();
Serial.println("World");
delay(500);
sgtl5000_1.volume(0.45);
SPI.setMOSI(7);
SPI.setSCK(14);
if (!(SD.begin(10))) {
while (1) {
Serial.println("Unable to access the SD card");
delay(500);
}
}
pinMode(13, OUTPUT); // LED on pin 13
delay(1000);
}
void loop() {
if (playSdWav1.isPlaying() == false) {
Serial.println("Start playing");
playSdWav1.play("SDTEST3.WAV");
delay(10); // wait for library to parse WAV info
}
// print the play time offset
Serial.print("Playing, now at ");
Serial.print(playSdWav1.positionMillis());
Serial.println(" ms");
// blink LED and print info while playing
digitalWrite(13, HIGH);
delay(250);
digitalWrite(13, LOW);
delay(250);
// read the knob position (analog input A2)
/*
int knob = analogRead(A2);
float vol = (float)knob / 1280.0;
sgtl5000_1.volume(vol);
Serial.print("volume = ");
Serial.println(vol);
*/
}
And this is the output:
Code:
Hello
World
Hello
Do you know what seems to be the problem?
Thanks,
Elad