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.

преди 10 години
преди 11 години
преди 10 години
преди 11 години
преди 10 години
преди 11 години
преди 10 години
преди 11 години
преди 10 години
преди 11 години
преди 10 години
преди 10 години
преди 11 години
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * A simple hardware test which receives audio from the audio shield
  3. * Line-In pins and send it to the Line-Out pins and headphone jack.
  4. *
  5. * This example code is in the public domain.
  6. */
  7. #include <Audio.h>
  8. #include <Wire.h>
  9. #include <SPI.h>
  10. #include <SD.h>
  11. // GUItool: begin automatically generated code
  12. AudioInputI2S i2s1; //xy=200,69
  13. AudioOutputI2S i2s2; //xy=365,94
  14. AudioConnection patchCord1(i2s1, 0, i2s2, 0);
  15. AudioConnection patchCord2(i2s1, 1, i2s2, 1);
  16. AudioControlSGTL5000 sgtl5000_1; //xy=302,184
  17. // GUItool: end automatically generated code
  18. const int myInput = AUDIO_INPUT_LINEIN;
  19. //const int myInput = AUDIO_INPUT_MIC;
  20. void setup() {
  21. // Audio connections require memory to work. For more
  22. // detailed information, see the MemoryAndCpuUsage example
  23. AudioMemory(12);
  24. // Enable the audio shield, select input, and enable output
  25. sgtl5000_1.enable();
  26. sgtl5000_1.inputSelect(myInput);
  27. sgtl5000_1.volume(0.5);
  28. }
  29. elapsedMillis volmsec=0;
  30. void loop() {
  31. // every 50 ms, adjust the volume
  32. if (volmsec > 50) {
  33. float vol = analogRead(15);
  34. vol = vol / 1023.0;
  35. //audioShield.volume(vol); // <-- uncomment if you have the optional
  36. volmsec = 0; // volume pot on your audio shield
  37. }
  38. }