Rotary encoder midi!

The Uno doesn't support MIDI over USB like a Teensy does. You can get it to work by flashing custom firmware to the on-board ATmega16U2. I explained everything in this article: Custom Arduino MIDI Controller. You can find example sketches as well, or you could check the source files of the library, to see how I implemented it.

The MIDI_Controller library (download it from the link above) includes this very simple example:

#include <MIDI_controller.h>

const static byte Channel = 1;
const static byte Controller = 0x14;

RotaryEncoder enc(2,3,Controller,Channel,1,JOG,POS1_NEG127); // Create a new member of the class 'RotaryEncoder', called 'enc', on pin 2 and 3, controller number 0x14, on channel1, no change in speed (speed is multiplied by 1), it's used as a Jog wheel, and the mode is set to POS1_NEG127.

void setup(){
  setupMidi(13, 10); // Setup the MIDI communication, with an LED on pin 13, and a delay of 10ms after every message.
}

void loop(){
  enc.refresh();
}

Pieter