-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSoundVisualizer.ino
More file actions
61 lines (56 loc) · 1.14 KB
/
SoundVisualizer.ino
File metadata and controls
61 lines (56 loc) · 1.14 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "include/defines.h"
#include "include/styles.h"
void setup()
{
pinMode(CHANNEL, INPUT);
pinMode(BUTTON1, INPUT_PULLUP);
pinMode(BUTTON2, INPUT_PULLUP);
pinMode(BUTTON3, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(BUTTON1), changeMode, FALLING);
attachInterrupt(digitalPinToInterrupt(BUTTON2), changeColor, FALLING);
attachInterrupt(digitalPinToInterrupt(BUTTON3), changeBrightness, FALLING);
Serial.begin(115200);
while (!Serial)
{
}
FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.clear(); // clear all pixel data
}
void loop()
{
vizualizer();
ESP.wdtFeed(); // reset the WatchDog Timer
}
// to switch between modes.
void vizualizer()
{
switch (currentMode)
{
case 0:
FastLED.clear();
musicVisualizer();
break;
case 1:
FastLED.clear();
pong();
break;
case 2:
FastLED.clear();
staticColor();
break;
case 3:
FastLED.clear();
fadeColor();
break;
case 4:
FastLED.clear();
fire();
break;
case 5:
FastLED.clear();
rainbowCycle(rainbowSpeed);
break;
default:
break;
}
}