[HELP] Midi button LED control code.

yeah

Joeking:
plus now when I enter the old code back in only two buttons are working? any ideas?

Looks like your wiring is faulty then. You mush have disturbed it.

When I plug it in with your code logic flashes up a message saying:
Changed midi number of outputs - 16 inputs and 16 outputs are available.
I'm so confused now.

You were right! A ground had come off while I was trying to make some space for the lights.
I've got all the buttons working on the old messy code, but when I change it to yours it doesn't work right.
I press any button and it works once then nothing works after that.

Joeking:
When I plug it in with your code logic flashes up a message saying:
Changed midi number of outputs - 16 inputs and 16 outputs are available.
I'm so confused now.

What flashes up with that message?
It looks like your DAW is seeing lots of MIDI interfaces when their is only one.

Joeking:
I've got all the buttons working on the old messy code, but when I change it to yours it doesn't work right.
I press any button and it works once then nothing works after that.

Like I said I have tested my code and it works so their must be something wrong with your wiring or your MIDI setup in your computer.

This bit of code in your listing

while (usbMIDI.read()) {
  }

Was removed so maybe something in your setup requires this so try putting it back as the last thing in the loop function.