how to get collision to control servo motors

I have object A colliding with object B. I would like this collision to be detected and to use the detected collision to control a servo motor to move left.

The OnCollisionEnter, OnCollisionStay, and OnCollisionExit event can be used in a script to perform actions during collisions; there are also similar events for Trigger interactions, and seperate events for collisions and triggers with 2D physics. For more details on this subject, refer to the Unity Manual’s section on Colliders, and the Unity Tutorials on Physics.