First thing I would do, if that's a 24V servo, is check in its datasheet if it a) is controlled by a 5V signal and b) if so, are they the normal 1000-1500-2000ms signals we use here in ArduinoLand.
(Or do you know what for a fact already?)
edit: sorry I missed the below so you presumably do know your servo works with the library?
I have already write a code for continuous operation as below:
I have already write a code for continuous operation as below:
That looks like the servo sweep example. Does your servo do what the code says? Where is the code for the proximity switch? Does the servo provide positional feedback? If not how do you know if the motor is running or in position?
a7md7sam:
If Arduino can't be used, how can i control this motor?
Well we don't know it can't, yet. I asked earlier if you had tried the sketch you wrote (aka sweep) and you didn't answer, so it's not clear if you tried it or not.
As to the second part, how, that would surely require you to give links to the datasheet?
a7md7sam:
I don't have the datasheets but it is industrial one.
If Arduino can't be used, how can i control this motor?
In all probability an Arduino can be used. But I doubt very much if the Arduino Servo library is relevant. Industrial servos have more in common with stepper motors.
However without the datasheet or any information at all from you about the motor how can you expect help?