I'm trying to send periodically clock from arduino to Electron Digitakt synth with 120 bpm. It means I need to send 0xF8 every 21ms (60000/bpm/ppq -> ppq = 24 pulses per quarter)
My code looks like
void setup()
{
Serial.begin(31250);
for (int i=0; i<10; i++) { Serial.write(byte(0xFF)); } // reset the slave
Serial.write(byte(0xFA)); // send start command
delay(10);
}
void loop () {
Serial.write(byte(0xF8));
delay(21);
}
But I see that my synth switches to Play but BPM doesn't change. I use logic analyser to check the output, it shows that this byte sends every 21ms (+- 1.2ms, usually a half of ms). Tried several libs for arduino with midi management, nothing helped
Could you help me to understand where is an issue?