I am attempting to play a wav file from an SD card using a Teensy 3.5. I am using this buzzer and I have the following code currently:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioPlaySdWav playSdWav1; //xy=557,157
AudioOutputPWM pwm1; //xy=889,184
AudioConnection patchCord1(playSdWav1, 0, pwm1, 0);
AudioConnection patchCord2(playSdWav1, 1, pwm1, 0);
// GUItool: end automatically generated code
void setup() {
// put your setup code here, to run once:
Serial.begin(4800);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println("Play");
playSdWav1.play("sound.wav");
delay(100);
while (playSdWav1.isPlaying()) {
delay (100);
}
}
I don't know which pin is supposed to be outputting the PWM signal. I tried searching "patchCord1" to see what the parameters for it are, but was unsuccessful. The code was generated by The Audio System Design Tool.
As for the hardware configuration, I am attempting to wire the I/O
pin to various PWM pins (to check for output) with no success. I have GND
to Analog Ground and VCC
to 3.3V (250 mA max). This is according to this diagram.