Преглед изворни кода

Opps, restore WAV file example

dds
PaulStoffregen пре 10 година
родитељ
комит
b07ca4d215
1 измењених фајлова са 43 додато и 0 уклоњено
  1. +43
    -0
      examples/WavFilePlayer/WavFilePlayer.ino

+ 43
- 0
examples/WavFilePlayer/WavFilePlayer.ino Прегледај датотеку

@@ -0,0 +1,43 @@
#include <Audio.h>
#include <Wire.h>
#include <SD.h>
#include <SPI.h>

// Create the Audio components. These should be created in the
// order data flows, inputs/sources -> processing -> outputs
//
AudioPlaySdWav wav;
AudioOutputI2S dac;

// Create Audio connections between the components
//
AudioConnection c1(wav, 0, dac, 0);
AudioConnection c2(wav, 1, dac, 1);

// Create an object to control the audio shield.
//
AudioControlSGTL5000 audioShield;


void setup() {
// Audio connections require memory to work. For more
// detailed information, see the MemoryAndCpuUsage example
AudioMemory(5);

audioShield.enable();
audioShield.volume(0.5);

SPI.setMOSI(7);
SPI.setSCK(14);
if (SD.begin(10)) {
wav.play("01_16M.WAV");
}
}

void loop() {
float vol = analogRead(15);
vol = vol / 1024;
audioShield.volume(vol);
delay(20);
}


Loading…
Откажи
Сачувај