A cam is a specially shaped piece of wood, metal or hard wearing plastic, which is usually fixed to a rotating shaft.
A follower is held against the cam, either by its own weight or by a spring. As the cam turns (rotary motion) the follower moves up and down (reciprocating motion).
The distance and speed at which the follower moves depends on the shape of the cam.
Triangular Cam