   }
 }
 
-
-void sendCC(unsigned char mute) {
+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) {
+  if (cycle_ble >= CYCLE_TIME_BLE) {
     cycle_ble = 0;
-    ble.update(CYCLE_TIME);
+    ble.update(CYCLE_TIME_BLE);
   } else {
-    cycle_ble += 100;
+    cycle_ble += CYCLE_TIME;
   }
 
   if (isConnected) {

  if (button2.toggled()) {
    if (button2.read() == Button::PRESSED) {
      Serial.println("Button 2 has been pressed");
      if (isConnected) {
        // Send the note to reaper to set the marker
        midi.send(MIDI_COMMAND_ON, 0, 64);
      }
    } else {
      Serial.println("Button 2 has been released");
      if (isConnected) {
        midi.send(MIDI_COMMAND_OFF, 0, 64);
      }
    }
  }

  delay(100);
}

/**
   Author: Leonid Lezner
   License: MIT

   Required libraries: Adafruit_BluefruitLE_nRF51, Button
*/

#include <Arduino.h>
#include "Feather.h"
