The flywheel is a mechanical device for equalising the speed of rotation. In Leonardo's design, when the crank is turned fast enough, the four spheres will rise with centrifugal force until the chains are horizontal. Once the peak rotating speed is reached, the balls and the attached shaft spin at a constant speed.
The flywheel conserves motion and reduces the effort needed to sustain it. This helps steady the rotation of the shaft when it undergoes fluctuating or intermittent pressure. The principle was already known to Leonardo in the potter's wheel.