Basic Midi Controller

Hi guys!
I’m working on a very basic and small project (actually my first arduino project) based around my Arduino Uno.
The thing is fairly simple:
The goal is to control the Program “Qlab” with this controller (midi via USB).

I have 3 switches (in this case called “Go”, “Pause”, “Panic”) . Each one sends a different midi note. When it does it lights up an LED (green for Go, yellow for Pause and red for Panic.
There’s a fourth Led that simply lights up when the board is on, no programming for this one.

So I’ve installed the midi library, and I’ve inspired myself from the “basic I/O” example. But apparently I did something wrong in the code as the uno doesn’t seem to send any midi note out. could somone point me in the right direction?

here’s the code and thanks for your precious help!

#include <MIDI.h>

MIDI_CREATE_DEFAULT_INSTANCE();

#define LEDGREEN 5
#define LEDYELLOW 6
#define LEDRED 7

int switchGo = 0;
int switchPause = 0;
int switchPanic = 0;

void setup() {
  pinMode(2, INPUT);
  pinMode(3, INPUT);
  pinMode(4, INPUT);
  pinMode(LEDGREEN, OUTPUT);
  pinMode(LEDYELLOW, OUTPUT);
  pinMode(LEDRED, OUTPUT);
  MIDI.begin();

}

void loop() {
  switchGo = digitalRead(2);
  switchPause = digitalRead(3);
  switchPanic = digitalRead(4);

  if (switchGo == HIGH) {
    MIDI.sendNoteOn(50,127,2);
    digitalWrite(LEDGREEN, HIGH);
    delay(20);
    digitalWrite(LEDGREEN, LOW);
    MIDI.sendNoteOff(50,0,2);
  }
  if (switchPause == HIGH) {
    digitalWrite(LEDYELLOW, HIGH);
    MIDI.sendNoteOn(51,127,2);
    delay(20);
    digitalWrite(LEDYELLOW, LOW);
    MIDI.sendNoteOff(51,0,2);
  }
  if (switchPanic == HIGH) {
    digitalWrite(LEDRED, HIGH);
    MIDI.sendNoteOn(52,127,2);
    delay(20);
    digitalWrite(LEDRED, LOW);
    MIDI.sendNoteOff(52,0,2);
  }
  
  
}

Does the corresponding LEDs light up when you press the switch?

Also how is your midi device wired to your Arduino? Or is your intention to bridge through serial?

Hi thanks for your answer. Yes the led lights up when the correct switch is pressed. And for the rest, sorry, i wasn't clear enough. My arduino uno is my midi device, and I would like it to send midi through it's USB port.

Sorry I missed the part where you said you were using QLab in your post.

I’m not sure, but as your computer is unlikely to see your uno as a midi device, you’ll need additional software on your computer side to bridge the serial from your arduino to a midi port, which QLab should then read.

Alternatively I think you can flash the uno to show up as a midi device (bit extreme in this case perhaps :P)