Hey there!
I'm trying to simulate an On-Off motor but I don't seem to get it right. I managed to get an approximated behavior but It's not quite what I want.
I have a bicycle model setup in which I want a motor to turn the crank for certain positions of it.

I'm using the angle of the highlighted joint as state Independent Variable with the following angular velocity profile:

Instead of keeping 20rpm at all times and increasing it to 60 from 0-20°, 160-200° and 340-360°, I want it to only be active in these ranges.
If I change from 20 to 0rpm, the motor stops still. Is there a way to turn it on and off based on the angle of the joint?
I attached a video for the setup above, for behavior similar to what I want.
Thanks a lot!