positioning motor

4 years 7 months ago #29531692 by davidl57
positioning motor was created by davidl57
I am using a MDC2460 controller in closed loop position relative mode with a hal sensor on AIN2. I want my script:

while true
currentpos = getvalue(_AIC, 2)
print( "desiredAnalog", desiredAnalog, "\n")
print("current position ", currentpos, "\n")
' wait(50)
if ((currentpos >= (desiredAnalog + 10) or currentpos <= desiredAnalog -10)) then
print("setting position \n")
setcommand(_G, 1, desiredAnalog)
wait(100)
end if
end while
to position the motor at desiriedAnalog, in this case 450. what I get is no movement although I the values from the print say I should;
desired position 450, current position -447.

I this mode shouldn't the setcommand(_G, 1, desiredAnalog) tell the motor to go to position 450?

Please Log in or Create an account to join the conversation.

4 years 7 months ago - 4 years 7 months ago #29531695 by niko
Replied by niko on topic positioning motor
Hello david,

You need to connect the analog input as feedback. If you do that, then it will be easy to do without any scripiting.

Please Log in or Create an account to join the conversation.

Moderators: tonysantoni
Time to create page: 0.123 seconds