Linear Reciprocation With One Way Interrupted Deg. Rotation
Input: blue slider linearly reciprocating.
Output: green shaft.
When the slider moves up, at upper end of its stroke the shaft rotates 180 deg. thanks to gear-rack drive and then the shaft moves to the right by interaction of the pin on yellow shifter and violet upper cam.
When the slider moves down, the shaft does not rotate at all because the gear and the rack are not in merge. At lower end of the slider stroke the shaft moves to the left by interaction of the pin on yellow shifter and violet lower cam.
Red spring pin is for positioning the yellow shifter and the shaft.