Syncing Processing with Ableton Live (via Midi timecode? Ableton Link?)

Hi! I have been trying to find a way to sync my processing code
(which controls some flip dot modules) and Ableton Live, such
that the dots will flip in sync to some music that’s playing in Live.
(It can be the other way around too - i.e. Ableton being the slave.)

Does anyone know the best way I would be able to achieve this?

I have been looking for some midibus library examples and other
posts here, but haven’t found anything relevant.

Any pointers would be much appreciated! Thank you!

Here is video of the dots being flipped by Processing: