-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathlowpassFilter.ino
More file actions
46 lines (38 loc) · 966 Bytes
/
lowpassFilter.ino
File metadata and controls
46 lines (38 loc) · 966 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
41
42
43
44
45
46
#include <btAudio.h>
btAudio audio = btAudio("ESP_Speaker");
String command;
void setup() {
// Streams audio data to the ESP32
audio.begin();
// Re-connects to last connected device
audio.reconnect();
// Outputs the received data to an I2S DAC, e.g. https://www.adafruit.com/product/3678
int bck = 26;
int ws = 27;
int dout = 25;
audio.I2S(bck, dout, ws);
// Opens the serial port
Serial.begin(115200);
}
int fo=3;
float fc;
void loop() {
delay(300);
if(Serial.available()){
command = Serial.readStringUntil('#');
if(command.equals("hp")){
Serial.println("Setting a High-Pass Filter...");
fc =Serial.parseFloat();
audio.createFilter(fo, fc, highpass);
}
else if(command.equals("stopFilt")){
audio.stopFilter();
Serial.println("Stopping Filter...");
}
else if(command.equals("lp")){
Serial.println("Setting a Low-Pass Filter...");
fc =Serial.parseFloat();
audio.createFilter(fo, fc, lowpass);
}
}
}