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.

51 rinda
1.0KB

  1. // demonstrate pulse with slow changes in pulse width
  2. #include <Audio.h>
  3. #include <Wire.h>
  4. #include <SPI.h>
  5. #include <SD.h>
  6. // GUItool: begin automatically generated code
  7. AudioSynthWaveform waveform1; //xy=188,240
  8. AudioEffectEnvelope envelope1; //xy=371,237
  9. AudioOutputI2S i2s1; //xy=565,241
  10. AudioConnection patchCord1(waveform1, envelope1);
  11. AudioConnection patchCord2(envelope1, 0, i2s1, 0);
  12. AudioConnection patchCord3(envelope1, 0, i2s1, 1);
  13. AudioControlSGTL5000 audioShield; //xy=586,175
  14. // GUItool: end automatically generated code
  15. void setup(void)
  16. {
  17. // Set up
  18. AudioMemory(8);
  19. audioShield.enable();
  20. audioShield.volume(0.45);
  21. waveform1.pulseWidth(0.5);
  22. waveform1.begin(0.4, 220, WAVEFORM_PULSE);
  23. envelope1.attack(50);
  24. envelope1.decay(50);
  25. envelope1.release(250);
  26. }
  27. void loop() {
  28. float w;
  29. for (uint32_t i =1; i<20; i++) {
  30. w = i / 20.0;
  31. waveform1.pulseWidth(w);
  32. envelope1.noteOn();
  33. delay(800);
  34. envelope1.noteOff();
  35. delay(600);
  36. }
  37. }