Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

111 lines
1.9KB

  1. #include <Audio.h>
  2. #include <Wire.h>
  3. //#include <WM8731.h>
  4. #include <SD.h>
  5. #include <SPI.h>
  6. //AudioInputI2S adc;
  7. //AudioInputAnalog ana(16);
  8. AudioSineWave mysine;
  9. AudioSineWave sine2;
  10. //AudioOutputPWM myout;
  11. //AudioPlaySDcardWAV wav;
  12. //AudioPlaySDcardRAW wav;
  13. //AudioMixer4 mix;
  14. AudioOutputI2S dac;
  15. //AudioControl_WM8731 codec;
  16. AudioControlSGTL5000 codec;
  17. AudioConnection c1(mysine, dac);
  18. //AudioConnection c1(wav, dac);
  19. //AudioConnection c2(wav, 1, dac, 1);
  20. int volume = 0;
  21. void setup() {
  22. Serial1.begin(115200);
  23. Serial1.println("***************");
  24. while (!Serial) ;
  25. delay(100);
  26. codec.enable();
  27. //while(1);
  28. delay(200);
  29. Serial.println("Begin AudioTest");
  30. delay(50);
  31. Serial1.print("B");
  32. // Audio connections require memory to work. For more
  33. // detailed information, see the MemoryAndCpuUsage example
  34. AudioMemory(15);
  35. //mysine.connect(myout);
  36. //mysine.connect(dac);
  37. //mysine.connect(dac, 1, 0);
  38. mysine.frequency(440);
  39. //wav.connect(dac);
  40. //wav.connect(dac, 1, 0);
  41. //codec.inputLinein();
  42. codec.volume(40);
  43. //adc.connect(dac);
  44. //ana.connect(dac);
  45. //ana.connect(dac, 1, 0);
  46. /*
  47. SPI.setMOSI(7);
  48. SPI.setSCK(14);
  49. if (SD.begin(10)) {
  50. Serial.println("SD init ok");
  51. //wav.play("01_16M.WAV");
  52. }
  53. */
  54. Serial.println("setup done");
  55. }
  56. void loop() {
  57. /*
  58. Serial.print("cpu: ");
  59. Serial.print(AudioProcessorUsage());
  60. Serial.print(", max: ");
  61. Serial.print(AudioProcessorUsageMax());
  62. Serial.print(", memory: ");
  63. Serial.print(AudioMemoryUsage());
  64. Serial.print(", max: ");
  65. Serial.print(AudioMemoryUsageMax());
  66. Serial.println("");
  67. */
  68. //int n;
  69. //n = analogRead(15);
  70. //Serial.println(n);
  71. //if (n != volume) {
  72. //volume = n;
  73. //codec.volume((float)n / 10.23);
  74. //}
  75. //n = analogRead(16) / 8;
  76. //Serial.println(n);
  77. //mysine.frequency(200 + n * 4);
  78. //delay(5);
  79. }