18
18
import adafruit_displayio_ssd1306
19
19
import adafruit_midi
20
20
from adafruit_midi .control_change import ControlChange
21
+ import neopixel
22
+
23
+ # default MIDI channel (1-16)
24
+ midi_in_channel = 2
25
+ midi_out_channel = 2
21
26
22
27
# MIDI CC messages, values and names assigned to each encoder
23
28
cc_values = [
32
37
{'cc_val' : (1 , 3 ), 'cc_message' : (22 ), 'cc_name' : "Mod Bank" },
33
38
{'cc_val' : (1 , 3 ), 'cc_message' : (23 ), 'cc_name' : "Mode" },
34
39
{'cc_val' : (0 , 1 ), 'cc_message' : (102 ), 'cc_name' : "Bypass/Engage" },
35
- {'cc_val' : (60 , 200 ), 'cc_message' : (93 ), 'cc_name' : "Tap Tempo" },
40
+ {'cc_val' : (0 , 127 ), 'cc_message' : (93 ), 'cc_name' : "Tap Tempo" },
36
41
{'cc_val' : (0 , 1 ), 'cc_message' : (24 ), 'cc_name' : "Loop (R Hold)" },
37
42
{'cc_val' : (0 , 1 ), 'cc_message' : (25 ), 'cc_name' : "Scan (L Hold)" },
38
43
{'cc_val' : (0 , 127 ), 'cc_message' : (26 ), 'cc_name' : "Clear (Both Hold)" },
78
83
splash .append (status_area )
79
84
# MIDI over UART setup for MIDI FeatherWing
80
85
uart = busio .UART (board .TX , board .RX , baudrate = 31250 , timeout = 0.001 )
81
- midi_in_channel = 1
82
- midi_out_channel = 1
83
86
midi = adafruit_midi .MIDI (
84
87
midi_in = uart ,
85
88
midi_out = uart ,
135
138
pix2 .brightness = 0.5
136
139
pix3 = adafruit_seesaw .neopixel .NeoPixel (ss3 , 18 , 4 , auto_write = True )
137
140
pix3 .brightness = 0.5
141
+ # onboard Feather neopixel
142
+ pix_feather = neopixel .NeoPixel (board .NEOPIXEL , 1 , auto_write = True )
143
+ pix_feather .brightness = 0.5
138
144
# encoder position arrays
139
145
last_pos0 = [60 , 60 , 60 , 60 ]
140
146
last_pos1 = [60 , 60 , 60 , 0 ]
155
161
pix1 [r ] = colorwheel (c1 [r ])
156
162
pix2 [r ] = colorwheel (c2 [r ])
157
163
pix3 [r ] = colorwheel (c3 [r ])
164
+ # feather neopixel color
165
+ c_feather = 0
166
+ pix_feather [0 ] = colorwheel (c_feather )
158
167
# array of all 16 encoder positions
159
168
encoder_posititions = [60 , 60 , 60 , 60 , 60 , 60 , 60 , 60 , 0 , 0 , 0 , 120 , 0 , 0 , 0 , 0 ]
160
169
@@ -170,6 +179,7 @@ def __init__(self):
170
179
self .color = c0
171
180
self .index = 0
172
181
self .strip = pix0
182
+ self .feather_color = c_feather
173
183
174
184
async def send_midi (midi_msg ):
175
185
# sends MIDI message if send_msg is True/button pressed
@@ -191,7 +201,9 @@ async def send_midi(midi_msg):
191
201
async def rainbows (the_color ):
192
202
# Updates colors of the neopixels to scroll through rainbow
193
203
while True :
204
+ the_color .feather_color += 8
194
205
the_color .strip [the_color .index ] = colorwheel (the_color .color [the_color .index ])
206
+ pix_feather [0 ] = colorwheel (the_color .feather_color )
195
207
await asyncio .sleep (0 )
196
208
197
209
async def monitor_interrupts (pin0 , pin1 , pin2 , pin3 , the_color , midi_msg ): #pylint: disable=too-many-statements
0 commit comments