Input: yellow slider that has linear reciprocating motion.
Output: blue part that moves forwards, turns 180 deg., moves backwards and turns back 180 deg.
Orange pin fixed to the slider moves along helical groove of the blue part. This helical joint can be replaced with a screw-nut drive (the yellow part: nut; the blue part: screw).
The friction preventing the blue part from rotation must be set larger than the friction preventing the yellow part from translation to ensure that the blue part rotate only when it can not translate.
Grey outer pipe and the yellow slider are cut off haft for easy understanding.The mechanism is aimed at moving needle in a medical instrument.