Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

PlayWavFromSdCard.ino 868B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include <Audio.h>
  2. #include <Wire.h>
  3. #include <SD.h>
  4. #include <SPI.h>
  5. // Create the Audio components. These should be created in the
  6. // order data flows, inputs/sources -> processing -> outputs
  7. //
  8. AudioPlaySDcardWAV wav;
  9. AudioOutputI2S dac;
  10. // Create Audio connections between the components
  11. //
  12. AudioConnection c1(wav, 0, dac, 0);
  13. AudioConnection c2(wav, 1, dac, 1);
  14. // Create an object to control the audio shield.
  15. //
  16. AudioControlSGTL5000 audioShield;
  17. void setup() {
  18. // Audio connections require memory to work. For more
  19. // detailed information, see the MemoryAndCpuUsage example
  20. AudioMemory(5);
  21. audioShield.enable();
  22. audioShield.volume(20);
  23. SPI.setMOSI(7);
  24. SPI.setSCK(14);
  25. if (SD.begin(10)) {
  26. wav.play("01_16M.WAV");
  27. }
  28. }
  29. void loop() {
  30. float vol = analogRead(15);
  31. vol = vol / 10.24;
  32. audioShield.volume(vol);
  33. delay(20);
  34. }