Hairless midi not respondong

Hello, i'm building up a loop pedal station which is basically a MIDIcontroller made up of foot switches, i've tried a bunch of things to get the hairless midi working, but nothing seems to work. I'm working with an arduino nano I'm not really good at prgramming. here is the code

#include "MIDI.h"
#include "Controller.h"

struct HairlessMidiSettings : public midi::DefaultSettings
{
static const bool UseRunningStatus = false;
static const long BaudRate = 115200;
};
MIDI_CREATE_CUSTOM_INSTANCE(HardwareSerial, Serial, MIDI, HairlessMidiSettings);

byte NUMBER_BUTTONS = 9;
byte NUMBER_POTS = 0;
byte NUMBER_MUX_BUTTONS = 0;
byte NUMBER_MUX_POTS = 0;

Pot *POTS[] {};

Button BU1(2, 2, 102, 1, 5 );
Button BU2(3, 2, 103, 1, 5 );
Button BU3(4, 2, 104, 1, 5 );
Button BU4(5, 2, 105, 1, 5 );
Button BU5(6, 2, 106, 1, 5 );
Button BU6(7, 2, 107, 1, 5 );
Button BU7(8, 2, 108, 1, 5 );
Button BU8(9, 2, 109, 1, 5 );
Button BU9(11, 2, 110, 1, 5 );

Button *BUTTONS[] {&BU1, &BU2, &BU3, &BU4, &BU5, &BU6, &BU7, &BU8, &BU9};

Button *MUXBUTTONS[] {};

Pot *MUXPOTS[] {};

int pinButton = 12;
int LED = 10;
int stateLED = LOW;
int stateButton;
int previous = LOW;
long time = 0;
long debounce = 200;

void setup() {

MIDI.begin();
Serial.begin(38400);
pinMode(pinButton, OUTPUT);
pinMode(LED, OUTPUT);

}

void loop() {
if (NUMBER_BUTTONS != 0) updateButtons();
if (NUMBER_POTS != 0) updatePots();
if (NUMBER_MUX_BUTTONS != 0) updateMuxButtons();
if (NUMBER_MUX_POTS != 0) updateMuxPots();

stateButton = digitalRead(pinButton);
if(stateButton == HIGH && previous == LOW && millis() - time > debounce) {
if(stateLED == HIGH){
stateLED = LOW;
} else {
stateLED = HIGH;
}
time = millis();
}
digitalWrite(LED, stateLED);
previous == stateButton;
}

void updateButtons() {

// Cycle through Button array
for (int i = 0; i < NUMBER_BUTTONS; i = i + 1) {
byte message = BUTTONS*->getValue();*

  • if (message == 0) {*
    _ switch (BUTTONS*->Bcommand) {_
    _
    case 0:_
    MIDI.sendNoteOn(BUTTONS_->Bvalue, 127, BUTTONS->Bchannel);
    break;
    case 1: //CC*

    MIDI.sendControlChange(BUTTONS->Bvalue, 127, BUTTONS*->Bchannel);
    break;
    case 2: //Toggle*

    if (BUTTONS*->Btoggle == 0) {
    MIDI.sendControlChange(BUTTONS->Bvalue, 127, BUTTONS->Bchannel);
    BUTTONS->Btoggle = 1;
    }
    else if (BUTTONS->Btoggle == 1) {
    MIDI.sendControlChange(BUTTONS->Bvalue, 0, BUTTONS->Bchannel);
    BUTTONS->Btoggle = 0;
    }
    break;
    }
    }
    // Button is not pressed*

    * if (message == 1) {
    switch (BUTTONS->Bcommand) {
    case 0:
    MIDI.sendNoteOff(BUTTONS->Bvalue, 0, BUTTONS->Bchannel);
    break;
    case 1:
    MIDI.sendControlChange(BUTTONS->Bvalue, 0, BUTTONS->Bchannel);
    break;
    }
    }
    }
    }
    void updateMuxButtons() {_

    for (int i = 0; i < NUMBER_MUX_BUTTONS; i = i + 1) {
    _ MUXBUTTONS->muxUpdate();
    byte message = MUXBUTTONS->getValue();
    if (message == 0) {
    switch (MUXBUTTONS->Bcommand) {
    case 0:
    MIDI.sendNoteOn(MUXBUTTONS->Bvalue, 127, MUXBUTTONS->Bchannel);
    break;
    case 1:
    MIDI.sendControlChange(MUXBUTTONS->Bvalue, 127, MUXBUTTONS->Bchannel);
    break;
    case 2: //Toggle*

    if (MUXBUTTONS*->Btoggle == 0) {
    MIDI.sendControlChange(MUXBUTTONS->Bvalue, 127, MUXBUTTONS->Bchannel);
    MUXBUTTONS->Btoggle = 1;
    }
    else if (MUXBUTTONS->Btoggle == 1) {
    MIDI.sendControlChange(MUXBUTTONS->Bvalue, 0, MUXBUTTONS->Bchannel);
    MUXBUTTONS->Btoggle = 0;
    }
    break;
    }
    }
    if (message == 1) {
    switch (MUXBUTTONS->Bcommand) {
    case 0:
    MIDI.sendNoteOff(MUXBUTTONS->Bvalue, 0, MUXBUTTONS->Bchannel);
    break;
    case 1:
    MIDI.sendControlChange(MUXBUTTONS->Bvalue, 0, MUXBUTTONS->Bchannel);
    break;
    }
    }
    }
    }
    void updatePots() {_

    for (int i = 0; i < NUMBER_POTS; i = i + 1) {
    _ byte potmessage = POTS->getValue();
    if (potmessage != 255) MIDI.sendControlChange(POTS->Pcontrol, potmessage, POTS->Pchannel);
    }
    }
    void updateMuxPots() {_

    for (int i = 0; i < NUMBER_MUX_POTS; i = i + 1) {
    _ MUXPOTS->muxUpdate();
    byte potmessage = MUXPOTS->getValue();
    if (potmessage != 255) MIDI.sendControlChange(MUXPOTS->Pcontrol, potmessage, MUXPOTS->Pchannel);
    }
    }*_

To test Hairless MIDI I used the following code from an instructable, the link is in a comment.

I just now loaded it onto an Uno and saw the notes coming through on the Hairless monitor and heard them being played on GarageBand. I had to set the serial port baud rate in Hairless preferences to match the baud rate set in Arduino.

/*
MIDI On/Off Messages
By Amanda Ghassaei
July 2012
http://www.instructables.com/id/Send-and-Receive-MIDI-with-Arduino/

 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.

*/
 
 int velocity = 100;//velocity of MIDI notes, must be between 0 and 127
 //higher velocity usually makes MIDI instruments louder
 
 int noteON = 144;//144 = 10010000 in binary, note on command
 int noteOFF = 128;//128 = 10000000 in binary, note off command

void setup() {
  //  Set MIDI baud rate:
  Serial.begin(9600);
}

void loop() {
  for (int note=50;note<70;note++) {//from note 50 (D3) to note 69 (A4)
    MIDImessage(noteON, note, velocity);//turn note on
    delay(300);//hold note for 300ms
    MIDImessage(noteOFF, note, velocity);//turn note off
    delay(200);//wait 200ms until triggering next note
  }
}

//send MIDI message
void MIDImessage(int command, int MIDInote, int MIDIvelocity) {
  Serial.write(command);//send note on or note off command 
  Serial.write(MIDInote);//send pitch data
  Serial.write(MIDIvelocity);//send velocity data
}