The difference between the UNO and the Nano is that the UNO has an ATmega16U2 microcontroller that handles the Serial-to-USB communication. It is a general purpose, programmable microcontroller, so you can flash MIDI USB firmware to it.
The Nano has a single-purpose FTDI chip for Serial-to-USB. It only does Serial (CDC), no MIDI.
I'd recommend to get an Arduino Micro, it supports MIDI over USB natively, without having to flash custom firmware.
If you really want to use the Nano, you can use a software tool like Hairless MIDI<--> Serial.
Read more here: MIDI_controller/wiki/MIDI-over-USB
The code for a single MIDI button is really easy:
[color=#5e6d03]#include[/color] [color=#434f54]<[/color][b][color=#d35400]MIDI_Controller[/color][/b][color=#434f54].[/color][color=#000000]h[/color][color=#434f54]>[/color] [color=#434f54]// Include the library[/color]
[color=#00979c]const[/color] [color=#00979c]uint8_t[/color] [color=#000000]velocity[/color] [color=#434f54]=[/color] [color=#000000]0b1111111[/color][color=#000000];[/color] [color=#434f54]// Maximum velocity (0b1111111 = 0x7F = 127)[/color]
[color=#00979c]const[/color] [color=#00979c]uint8_t[/color] [color=#000000]C4[/color] [color=#434f54]=[/color] [color=#000000]60[/color][color=#000000];[/color] [color=#434f54]// Note number 60 is defined as middle C in the MIDI specification[/color]
[color=#434f54]// Create a new instance of the class 'Digital', called 'button', on pin 2, that sends MIDI messages with note 'C4' (60) on channel 1, with velocity 127[/color]
[b][color=#d35400]Digital[/color][/b] [color=#000000]button[/color][color=#000000]([/color][color=#000000]2[/color][color=#434f54],[/color] [color=#000000]C4[/color][color=#434f54],[/color] [color=#000000]1[/color][color=#434f54],[/color] [color=#000000]velocity[/color][color=#000000])[/color][color=#000000];[/color]
[color=#00979c]void[/color] [color=#5e6d03]setup[/color][color=#000000]([/color][color=#000000])[/color] [color=#000000]{[/color][color=#000000]}[/color]
[color=#00979c]void[/color] [color=#5e6d03]loop[/color][color=#000000]([/color][color=#000000])[/color] [color=#000000]{[/color]
[color=#434f54]// Refresh the button (check whether the button's state has changed since last time, if so, send it over MIDI)[/color]
[b][color=#d35400]MIDI_Controller[/color][/b][color=#434f54].[/color][color=#d35400]refresh[/color][color=#000000]([/color][color=#000000])[/color][color=#000000];[/color]
[color=#000000]}[/color]
Using the MIDI_Controller library.
Pieter