How to rotate a gear or shaft in both direction using motion constraint

I am trying to rotate one shaft with motion constrain with respect to a gear.but i want motion of shaft in one direction upto 180deg and then return from there rotating in opposite direction.

2 Answers

I am trying this in autodesk inventor

click on the mate (right click) than choose drive.