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.

pirms 10 gadiem
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. Demo of the audio sweep function.
  3. The user specifies the amplitude,
  4. start and end frequencies (which can sweep up or down)
  5. and the length of time of the sweep.
  6. FMI:
  7. The audio board uses the following pins.
  8. 6 - MEMCS
  9. 7 - MOSI
  10. 9 - BCLK
  11. 10 - SDCS
  12. 11 - MCLK
  13. 12 - MISO
  14. 13 - RX
  15. 14 - SCLK
  16. 15 - VOL
  17. 18 - SDA
  18. 19 - SCL
  19. 22 - TX
  20. 23 - LRCLK
  21. */
  22. #include <Audio.h>
  23. #include <Wire.h>
  24. #include <SPI.h>
  25. #include <SD.h>
  26. #include <Bounce.h>
  27. AudioSynthToneSweep myEffect;
  28. AudioOutputI2S audioOutput; // audio shield: headphones & line-out
  29. // The tone sweep goes to left and right channels
  30. AudioConnection c1(myEffect, 0, audioOutput, 0);
  31. AudioConnection c2(myEffect, 0, audioOutput, 1);
  32. AudioControlSGTL5000 audioShield;
  33. float t_ampx = 0.8;
  34. int t_lox = 10;
  35. int t_hix = 22000;
  36. // Length of time for the sweep in seconds
  37. float t_timex = 10;
  38. // <<<<<<<<<<<<<<>>>>>>>>>>>>>>>>
  39. void setup(void)
  40. {
  41. Serial.begin(9600);
  42. while (!Serial) ;
  43. delay(3000);
  44. AudioMemory(2);
  45. audioShield.enable();
  46. audioShield.volume(0.5);
  47. Serial.println("setup done");
  48. if(!myEffect.play(t_ampx,t_lox,t_hix,t_timex)) {
  49. Serial.println("AudioSynthToneSweep - begin failed");
  50. while(1);
  51. }
  52. // wait for the sweep to end
  53. while(myEffect.isPlaying());
  54. // and now reverse the sweep
  55. if(!myEffect.play(t_ampx,t_hix,t_lox,t_timex)) {
  56. Serial.println("AudioSynthToneSweep - begin failed");
  57. while(1);
  58. }
  59. // wait for the sweep to end
  60. while(myEffect.isPlaying());
  61. Serial.println("Done");
  62. }
  63. void loop(void)
  64. {
  65. }