Ratchet Mechanism

This is used for case when the input linear motion is parallel to rotary axis of the ratchet wheel.
Input: blue slider of violet cam linearly reciprocating. Its source motion is not shown.
Output: green ratchet wheel interruptedly rotating.
Yellow slider receives motion from the violet cam.
Blue spring pin keeps the output immobile during backward stroke of the yellow slider.