# Help please..

**URL:** <https://forums.pimoroni.com/t/help-please/22443>\
**Category:** Support\
**Created:** [July 5, 2023, 9:19am UTC](https://forums.pimoroni.com/t/help-please/22443 "2023-07-05T09:19:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JammieMcCulloch](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@JammieMcCulloch](https://forums.pimoroni.com/u/JammieMcCulloch)\
**Post date:** [July 5, 2023, 9:19am UTC](https://forums.pimoroni.com/t/help-please/22443/1 "2023-07-05T09:19:16Z")

</div>

Hi. Turns round is to difficult to program it. Therefore I’d like to ask if any one could help me with this please?!

```auto
# 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

---

<div class="post-metadata">

**Author:** ![JammieMcCulloch](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@JammieMcCulloch](https://forums.pimoroni.com/u/JammieMcCulloch)\
**Post date:** [July 5, 2023, 9:21am UTC](https://forums.pimoroni.com/t/help-please/22443/2 "2023-07-05T09:21:48Z")

</div>

Just in case, I am showing below my entire code so far + comment notes:

```auto
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()

```
