If the tides change with the position of some heavenly body, then we can build cams that have shapes like the effect of the moon's orbit, and gear them together in the right order.
We can construct cams shaped like the moon's orbit.