Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Servo back and forth (http://www.chiefdelphi.com/forums/showthread.php?t=102251)

Luiz12 08-02-2012 02:53

Servo back and forth
 
Basically what I want my servo to do is start from 0 degree position, and when I press button one, I want it to travel the full 180 degrees but when I let go of the button I want it to return to its original position, here's so code I wrote down, I am an extremely rookie player so I barely have any knowledge on what to do but I gave it try. I'm currently using the HS-322HD servo.

ehochstein 08-02-2012 05:36

Re: Servo back and forth
 
The -1 and 1 constants basically mean the motor is going in full reverse or full forward. I suggest adding something such as a wait command and time how long it takes to go that far. I'm not a guru when it comes to Labview but all you are doing right there is taking the maximum and increasing it by 85. I can probably take a screen shot tomorrow when I get in if you need an example.

dbeckwith 08-02-2012 07:26

Re: Servo back and forth
 
It's pretty simple actually. You just use that triangular chooser and choose between 0 and 170 (which I believe is that max angle of the servos, not 180, but I could be wrong), then hook up that value to the Servo Set Angle. I think you just made it too complicated the way you did it, and the problem you had was you tried to perform a Boolean operation on two numbers at the bottom there.

DavidGitz 08-02-2012 10:20

Re: Servo back and forth
 
Quote:

Originally Posted by Wiifi (Post 1122249)
The -1 and 1 constants basically mean the motor is going in full reverse or full forward. I suggest adding something such as a wait command and time how long it takes to go that far. I'm not a guru when it comes to Labview but all you are doing right there is taking the maximum and increasing it by 85. I can probably take a screen shot tomorrow when I get in if you need an example.

This is true for the Set Output vi for Motor Controls. The OP is using a Servo and is using the Set Angle.vi, which takes in a range of 0-360 degrees I believe (most Servo's have a usable range of 180 degrees or less, see your servo datasheet for this info).

As dbeckwith said, the first problem is the boolean operator on the floating point wires. I don't know how this would work, but I'm sure it's not what you intended. From what you stated you only want to have one button to control this, so you don't need to use the OR at all (If you want to use another button to control this, you can use the OR to select either buttons). On the input of your Select use your button and the values should be 0 and your other value (I assume 180). The output of that should go directly into the Set Angle.vi. Finally calibrate your servo down position by removing the screw holding the servo horn, rotating the output gear to it's maximum down position and reinstall the servo horn and screw.

Luiz12 09-02-2012 00:31

Re: Servo back and forth
 
Would anyone be willing to give me their email. I constantly have programing issues and I need someone to help me on the spot.

DavidGitz 09-02-2012 13:30

Re: Servo back and forth
 
1 Attachment(s)
Attached is an example of what I was suggesting, using 2 joysticks. You can PM me if you still need more help.

slijin 09-02-2012 14:07

Re: Servo back and forth
 
Quote:

Originally Posted by dbeckwith (Post 1122263)
You just use that triangular chooser and choose between 0 and 170 (which I believe is that max angle of the servos, not 180, but I could be wrong)

The maximum travel of the Hitec HS-322HD is 270 deg, not 170.


All times are GMT -5. The time now is 00:53.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi