MIDI CONTROLLER

Thanks for your answer
Here is my code </>
#include <MIDI.h>
#include <midi_Defs.h>
#include <midi_Message.h>
#include <midi_Namespace.h>
#include <midi_Settings.h>
#define midiChannel (char)1
MIDI_CREATE_DEFAULT_INSTANCE();

const int buttonPin1 = 6; // the pin that the pushbutton is attached to
const int buttonPin2 = 7;

int button1State = 0; // current state of the button
int lastButton1State = 0; // previous state of the button
int button2State = 0;
int lastButton2State = 0;

void setup() {
Serial.begin(115200);
// initialize the button pin as an input:
pinMode(buttonPin1, INPUT_PULLUP);
pinMode(buttonPin2, INPUT_PULLUP);

// begin MIDI communication:
MIDI.begin(MIDI_CHANNEL_OMNI);
}

void loop() {
// read the pushbutton input pin:
button1State = digitalRead(buttonPin1);
button2State = digitalRead(buttonPin2);

// compare the buttonState to its previous state:
// primo bottone
if (button1State != lastButton1State) {
if (button1State == LOW) {
delay(300);
if (button1State == LOW) {
MIDI.sendControlChange(105, 127, 1);
delay(150);

lastButton1State = button1State;
}
else if (button1State != lastButton1State) {
if (button1State == HIGH){
delay(200);
if (button1State == HIGH){
MIDI.sendControlChange(105, 0, 1);
delay(300);
lastButton1State = button1State;
}
}
}

}
}

//secondo bottone

if (button2State != lastButton2State) {
if (button2State == LOW) {
MIDI.sendControlChange(106, 127, 1);
delay(200);
lastButton1State = button1State;
}
else if (button2State != lastButton2State) {
if (button2State == HIGH);
MIDI.sendControlChange(106, 0, 1);
delay(200);
lastButton2State = button2State;
}
}
}