1818import adafruit_displayio_ssd1306
1919import adafruit_midi
2020from 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
2126
2227# MIDI CC messages, values and names assigned to each encoder
2328cc_values = [
3237 {'cc_val' : (1 , 3 ), 'cc_message' : (22 ), 'cc_name' : "Mod Bank" },
3338 {'cc_val' : (1 , 3 ), 'cc_message' : (23 ), 'cc_name' : "Mode" },
3439 {'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" },
3641 {'cc_val' : (0 , 1 ), 'cc_message' : (24 ), 'cc_name' : "Loop (R Hold)" },
3742 {'cc_val' : (0 , 1 ), 'cc_message' : (25 ), 'cc_name' : "Scan (L Hold)" },
3843 {'cc_val' : (0 , 127 ), 'cc_message' : (26 ), 'cc_name' : "Clear (Both Hold)" },
7883splash .append (status_area )
7984# MIDI over UART setup for MIDI FeatherWing
8085uart = busio .UART (board .TX , board .RX , baudrate = 31250 , timeout = 0.001 )
81- midi_in_channel = 1
82- midi_out_channel = 1
8386midi = adafruit_midi .MIDI (
8487 midi_in = uart ,
8588 midi_out = uart ,
135138pix2 .brightness = 0.5
136139pix3 = adafruit_seesaw .neopixel .NeoPixel (ss3 , 18 , 4 , auto_write = True )
137140pix3 .brightness = 0.5
141+ # onboard Feather neopixel
142+ pix_feather = neopixel .NeoPixel (board .NEOPIXEL , 1 , auto_write = True )
143+ pix_feather .brightness = 0.5
138144# encoder position arrays
139145last_pos0 = [60 , 60 , 60 , 60 ]
140146last_pos1 = [60 , 60 , 60 , 0 ]
155161 pix1 [r ] = colorwheel (c1 [r ])
156162 pix2 [r ] = colorwheel (c2 [r ])
157163 pix3 [r ] = colorwheel (c3 [r ])
164+ # feather neopixel color
165+ c_feather = 0
166+ pix_feather [0 ] = colorwheel (c_feather )
158167# array of all 16 encoder positions
159168encoder_posititions = [60 , 60 , 60 , 60 , 60 , 60 , 60 , 60 , 0 , 0 , 0 , 120 , 0 , 0 , 0 , 0 ]
160169
@@ -170,6 +179,7 @@ def __init__(self):
170179 self .color = c0
171180 self .index = 0
172181 self .strip = pix0
182+ self .feather_color = c_feather
173183
174184async def send_midi (midi_msg ):
175185 # sends MIDI message if send_msg is True/button pressed
@@ -191,7 +201,9 @@ async def send_midi(midi_msg):
191201async def rainbows (the_color ):
192202 # Updates colors of the neopixels to scroll through rainbow
193203 while True :
204+ the_color .feather_color += 8
194205 the_color .strip [the_color .index ] = colorwheel (the_color .color [the_color .index ])
206+ pix_feather [0 ] = colorwheel (the_color .feather_color )
195207 await asyncio .sleep (0 )
196208
197209async def monitor_interrupts (pin0 , pin1 , pin2 , pin3 , the_color , midi_msg ): #pylint: disable=too-many-statements
0 commit comments