Hi. Turns round is to difficult to program it. Therefore I’d like to ask if any one could help me with this please?!
# Loop through keys and attach decorators.
for key in keys:
# If pressed, send a MIDI note on command and light key.
@keybow.on_press(key)
def press_handler(key):
note = start_note + key.number
key.set_led(*rgb)
midi.send(NoteOn(note, velocity))
# If released, send a MIDI note off command and turn off LED.
@keybow.on_release(key)
def release_handler(key):
note = start_note + key.number
key.set_led(0, 0, 0)
midi.send(NoteOff(note, 0))
while True:
# Always remember to call keybow.update()!
keybow.update()
Change that to push button send midi note, light on - press another button send midi note, light on + disable other LEDs and so on
please help
Just in case, I am showing below my entire code so far + comment notes:
from pmk import PMK
from pmk.platform.rgbkeypadbase import RGBKeypadBase as Hardware
import usb_midi
import adafruit_midi
from adafruit_midi.program_change import ProgramChange
from adafruit_midi.control_change import ControlChange
keybow = PMK(Hardware())
keys = keybow.keys
midi = adafruit_midi.MIDI(midi_out=usb_midi.ports[1], out_channel=0)
rgb = (204, 255, 255)
program_change = 0
control_change = 0
# !Not sure what value shoud be here!
for key in keys:
@keybow.on_press(key)
def press_handler(key):
program = program_change + key.number
key.set_led(*rgb)
midi.send(ProgramChange(program))
# 9 keys to be PC, one active at the time, All LED + active diffrent
# KEYPAD LAYOUT:
# CC CC CC CC
# PC PC PC CC
# PC PC PC CC
# PC PC PC CC
while True:
keybow.update()
for key in keys:
@keybow.on_press(key)
def press_handler(key):
control = control_change + key.number
key.set_led(*rgb)
midi.send(ControlChange(control))
# 7 keys to be CC, multiple active at the time, ALL LED + active diffrent
while True:
keybow.update()