You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 satır
1.1KB

  1. #include <Audio.h>
  2. #include <Wire.h>
  3. #include <SPI.h>
  4. #include <SD.h>
  5. AudioSynthWaveform mysine(AudioWaveformSine);
  6. AudioOutputI2Sslave dac;
  7. AudioControlWM8731master codec;
  8. AudioConnection c1(mysine,dac);
  9. int volume = 0;
  10. void setup() {
  11. codec.enable();
  12. delay(100);
  13. while (!Serial) ;
  14. Serial.println("Begin AudioTest");
  15. // Audio connections require memory to work. For more
  16. // detailed information, see the MemoryAndCpuUsage example
  17. AudioMemory(15);
  18. mysine.frequency(440);
  19. mysine.amplitude(0.9);
  20. codec.volume(0.70);
  21. Serial.println("setup done");
  22. }
  23. void loop() {
  24. /*
  25. Serial.print("cpu: ");
  26. Serial.print(AudioProcessorUsage());
  27. Serial.print(", max: ");
  28. Serial.print(AudioProcessorUsageMax());
  29. Serial.print(", memory: ");
  30. Serial.print(AudioMemoryUsage());
  31. Serial.print(", max: ");
  32. Serial.print(AudioMemoryUsageMax());
  33. Serial.println("");
  34. */
  35. //int n;
  36. //n = analogRead(15);
  37. //Serial.println(n);
  38. //if (n != volume) {
  39. //volume = n;
  40. //codec.volume((float)n / 10.23);
  41. //}
  42. //n = analogRead(16) / 8;
  43. //Serial.println(n);
  44. //mysine.frequency(200 + n * 4);
  45. //delay(5);
  46. }