Dharani123:
I'll use the backemf as a sense for robots that is I'll make the robot reflex from this back emf reflexes towards pain on basing the level of back emf we can distinguish between pain and touch and the servos I intend to use are mg995 metal gear servos please suggest if i can do it with other types of servos too thank u so much
Two things
You do not get any back EMF from a servo, the servo motor electronics suppress it and it never appears anywhere.
You only get back EMF when you stop a motor and as this is your code you know when the motor stops because you told the motor to do so.
I think you are mixing up back EMF with stall current, you will not get any sensing function from back EMF.