forked from mfromano/micro-control
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaudio.ino
More file actions
executable file
·40 lines (34 loc) · 864 Bytes
/
audio.ino
File metadata and controls
executable file
·40 lines (34 loc) · 864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioSynthWaveformSine sine1; //xy=189,176
AudioEffectFade fade1; //xy=380,177
AudioOutputAnalog dac1; //xy=552,179
AudioConnection patchCord1(sine1, fade1);
AudioConnection patchCord2(fade1, dac1);
//
const uint8_t START_PIN = 4;
const float FQ = 10000; //Hz
const uint16_t FADE_MS = 500; // ms
void setup() {
AudioMemory(20);
pinMode(START_PIN,INPUT);
sine1.frequency(FQ);
sine1.height(0);
}
void loop() {
//if (digitalRead(START_PIN)) {
AudioNoInterrupts();
sine1.height(1);
fade1.fadeIn(FADE_MS)
AudioInterrupts();
while (digitalRead(START_PIN) {
;
}
fade1.fadeout(FADE_MS);
sine1.height(0);
//}
}