forked from zircothc/DRUM_2004_V1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathled.ino
177 lines (165 loc) · 5.1 KB
/
led.ino
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
void REFRESH_LEDS(){
boolean refresh=false;
if (refreshMODES){
refreshMODES=false;
refresh=true;
// Borrar modos
for (byte f=16;f<24;f++){
strip.setPixelColor(real_led[f],strip.Color(0, 0, 0));
}
switch (modeZ){
case tPad:
strip.setPixelColor(real_led[16],strip.Color(0, 200, 0));
break;
case tSel:
strip.setPixelColor(real_led[16],strip.Color(0, 0, 200));
break;
case tWrite:
strip.setPixelColor(real_led[16],strip.Color(200, 0, 0));
break;
case tMute:
strip.setPixelColor(real_led[20],strip.Color(0, 0, 200));
break;
case tSolo:
strip.setPixelColor(real_led[20],strip.Color(200, 0, 0));
break;
case tMelod:
strip.setPixelColor(real_led[20],strip.Color(200, 200, 0));
break;
case tClear:
strip.setPixelColor(real_led[20],strip.Color(200, 80, 0));
break;
case tLoadP:
strip.setPixelColor(real_led[18],strip.Color(0, 0, 200));
break;
case tLoadS:
strip.setPixelColor(real_led[18],strip.Color(0, 200, 200));
break;
case tLoaPS:
strip.setPixelColor(real_led[18],strip.Color(100, 200, 200));
break;
case tSaveP:
strip.setPixelColor(real_led[19],strip.Color(200, 0, 0));
break;
case tSaveS:
strip.setPixelColor(real_led[19],strip.Color(200, 200, 0));
break;
case tSavPS:
strip.setPixelColor(real_led[19],strip.Color(200, 200, 100));
break;
case tRndS:
strip.setPixelColor(real_led[17],strip.Color(100, 100, 0));
break;
case tRndP:
strip.setPixelColor(real_led[17],strip.Color(100, 0, 100));
break;
case tRndNo:
strip.setPixelColor(real_led[17],strip.Color(0, 100, 100));
break;
case tPiano:
strip.setPixelColor(real_led[21],strip.Color(100, 20, 60));
break;
case tSong:
strip.setPixelColor(real_led[23],strip.Color(50, 50, 200));
break;
}
// play/stop
if (playing) {
strip.setPixelColor(real_led[22],strip.Color(30, 200, 30));
}
if (recording) {
strip.setPixelColor(real_led[22],strip.Color(200, 0, 0));
}
// song
if (songing) {
strip.setPixelColor(real_led[23],strip.Color(100, 0, 100));
}
}
if (refreshPATTERN){
refreshPATTERN=false;
refresh=true;
switch (modeZ){
case tWrite:
for (byte f=0;f<16;f++){
if bitRead(pattern[selected_sound],f){
strip.setPixelColor(real_led[f],strip.Color(250, 50, 50));
} else {
strip.setPixelColor(real_led[f],strip.Color(0, 0, 0));
}
}
break;
case tMute:
//refresh=true;
for (byte f=0;f<16;f++){
if bitRead(mutes,f){
strip.setPixelColor(real_led[f],strip.Color(220, 50, 0));
} else {
strip.setPixelColor(real_led[f],strip.Color(0, 0, 0));
}
}
break;
case tSolo:
//refresh=true;
for (byte f=0;f<16;f++){
if bitRead(solos,f){
strip.setPixelColor(real_led[f],strip.Color(50, 220, 0));
} else {
strip.setPixelColor(real_led[f],strip.Color(0, 0, 0));
}
}
break;
case tMelod:
//refresh=true;
for (byte f=0;f<16;f++){
if bitRead(isMelodic,f){
strip.setPixelColor(real_led[f],strip.Color(100, 50, 220));
} else {
strip.setPixelColor(real_led[f],strip.Color(0, 0, 0));
}
}
break;
case tFirst:
strip.setPixelColor(real_led[firstStep],strip.Color(0, 220, 0));
break;
case tLast:
strip.setPixelColor(real_led[newLastStep],strip.Color(220, 0, 0));
break;
}
}
if (refreshSTEP){
refreshSTEP=false;
// Si SEQ activo muestro los pads que suenan
if (playing ){
for (byte f=0;f<16;f++){
if bitRead(pattern[f],sstep){
strip.setPixelColor(real_led[f],strip.Color(0, 50, 200));
}
}
}
// Mostrar step actual
strip.setPixelColor(real_led[sstep],strip.Color(200, 200, 0));
}
if (clearPATTERN){
clearPATTERN=false;
if (modeZ!=2){
refresh=true;
for (byte f=0;f<16;f++){
strip.setPixelColor(real_led[f],strip.Color(0, 0, 0));
}
}
// refresco lo que hay en el step en el siguiente bucle
refreshPATTERN=true;
}
if (refresh) strip.show();
}
void REFRESH_VUMETER(){
// if (vmeter>255) vmeter=255;
// int xleds=map(vmeter,0,255,0,7);
// for (byte f=24;f<32;f++){
// strip.setPixelColor(real_led[f],strip.Color(0, 0, 0));
// }
// for (byte f=24;f<24+xleds;f++){
// strip.setPixelColor(real_led[f],strip.Color(100, 255, 100));
// }
// strip.show();
}