Barrel Cam for Deg. Rotation

Each push makes blue cam shaft go down and turn 180 deg. when going up. Violet pin has prismatic joint with grey base.
Red spring forces the pin toward the blue cam shaft.
Key factor is different deepths of the cam groove.
Developed cam is shown on the left. Portions in dark blue are deepest. The base is cutt off half for easy understanding.