diff --git a/examples/ESP32UartMasterMidiClock/ESP32UartMasterMidiClock.ino b/examples/ESP32UartMasterMidiClock/ESP32UartMasterMidiClock.ino index 9de6708..f83952b 100644 --- a/examples/ESP32UartMasterMidiClock/ESP32UartMasterMidiClock.ino +++ b/examples/ESP32UartMasterMidiClock/ESP32UartMasterMidiClock.ino @@ -18,6 +18,8 @@ // the blue led #define LED_BUILTIN 2 +volatile bool _midi_clk_income = false; + uint8_t bpm_blink_timer = 1; void handle_bpm_led(uint32_t tick) { @@ -37,6 +39,7 @@ void handle_bpm_led(uint32_t tick) void ClockOut96PPQN(uint32_t tick) { // Send MIDI_CLOCK to external gears //Serial.write(MIDI_CLOCK); + _midi_clk_income = true; handle_bpm_led(tick); } @@ -71,5 +74,11 @@ void setup() { // Do it whatever to interface with Clock.stop(), Clock.start(), Clock.setTempo() and integrate your environment... void loop() { - + // watch for income signal from uClock to fire the clock over midi + if (_midi_clk_income) { + Serial.write(MIDI_CLOCK); + noInterrupts(); + _midi_clk_income = false; + interrupts(); + } }