Leonardo often uses rotating cams (wheels with shaped bumps on them) to produce different mechanical movements. In this machine below, when the cam is turned by a crank, the bumps on the cam change the circular motion into an up-and-down motion. The cam raises the hammer, which then falls with all of its weight, striking one blow in the same position each time.
The mechanism might have been designed to help blacksmiths who used a hammer and anvil to shape swords, horseshoes and other tools.