Midi usb problem on Leonardo with encoder ky040

First lesson:

always. And I I say always I mean always
post your actual and complete sketch as a code-section

Here is the description how you post code as a code-section
please edit your posting to present your code as a code-section

click on the pencil-icon below your posting and then re-edit your posting following this short tutorial

best regards Stefan