Four Bar Linkage

Four bars: blue, yellow, green and pink.
Input: the yellow bar rotating continuously.
Orange lever with positioning spring pin is for controlling the linkage.
When the orange lever enters in the slot of the blue bar, the latter is kept immobile and the green bar oscillates.
When the orange lever is not in the slot of the blue bar, the blue bar oscillates and the green bar does not move because of its huge mass.
The mechanism used to be applied for fan swinging control.