   if (button2.toggled()) {
     if (button2.read() == Button::PRESSED) {
       Serial.println("Button 2 has been pressed");
+      digitalWrite(ledPin, HIGH);
       if (isConnected) {
         // Send the note to reaper to set the marker
-        midi.send(MIDI_COMMAND_ON, 0, 64);
+        sendMidiNote(true, 0, 0, 64);
       }
     } else {
       Serial.println("Button 2 has been released");
-      if (isConnected) {
-        midi.send(MIDI_COMMAND_OFF, 0, 64);
+      digitalWrite(ledPin, LOW);
+      if (isConnected) {
+        sendMidiNote(false, 0, 0, 64);
       }
     }
   }
 
-  delay(100);
-}
+  delay(CYCLE_TIME);
+}

  if (button1.toggled()) {
    if (button1.read() == Button::PRESSED) {
      Serial.println("Button 1 has been pressed");
      if (isConnected) {
        sendCC(1);
      }
    } else {
      Serial.println("Button 1 has been released");
      if (isConnected) {
        sendCC(0);
      }
    }
  }

  }
}

void sendMuteCommand(bool mute) {
  // Send CC message on channel 0, controller 1
  midi.send(0xB0, 1, mute ? 127 : 0);
}

void sendMidiNote(bool onState, unsigned char channel, unsigned char note, unsigned char velocity) {
  midi.send((onState ? 0x90 : 0x80) | (channel & 0x0F), note, velocity);
}

void loop() {
  if (cycle_ble >= CYCLE_TIME_BLE) {
    cycle_ble = 0;
    ble.update(CYCLE_TIME_BLE);
  } else {
    cycle_ble += CYCLE_TIME;
  }

  if (isConnected) {
