MIDIUSB arduino as master clock

I am building a MID adaptor using an arduino Due. I want it to be able to transmit the midi input from my hardware to my computer via USB for example to sync ableton live or some other software.

I wrote this simple program that should act as a MIDI master clock but I can't seem to make ableton respond to it. Can anyone tell me if I'm doing something wrong here? thank you very much.

#include "MIDIUSB.h"

//Pulse per quarter note. Each beat has 24 pulses.

void setup() {

  MidiUSB.sendMIDI({0xFA, 0, 0, 0});
  void flush(void);


void loop() {

  MidiUSB.sendMIDI({0xF8, 0, 0, 0});
  void flush(void);


You're sending invalid MIDI USB packets. See the MIDI USB spec for details: the first byte consists of the cable number and the code index number, which is 0xF for real-time messages.

You need {0x0F, 0xFA, 0, 0} and {0x0F, 0xF8, 0, 0} for "Start" and "Timing Clock" respectively.

Also, void flush(void); is a function declaration, you need a function call: MidiUSB.flush();


  void flush(void);

Is a declaration of a function prototype, not a method call.

  MidiUSB.flush() ;

As per examples