Help with sevo programming

i have done research on how to program the servo with camera, and came up with the following code, my question is how to program in labview so that when a press lets say button 3 on joystick /1 (joystick 2) it turns right /(up), button 2 it turns left/ (down), then back to the orginal position (not sure what loop to use)





I’m not entirely sure what you’re asking, but when I programmed our servo code, when a button was pressed, the servo would move and stay in that position until it was told to move elsewhere. I used a case statement for each servo. I threaded the bool value from the get -> Button 3 (or whatever button you choose) to the case statement. If the button is pressed, move the servo a few degrees. If not, do nothing. It’s simple code, but is working fine for us. I hope that helps

I am sorry, what I meant was: say I press button 3, the servo moves then goes back to the original position.

In the programming I did; the begin vi is shown on the bottom and what I programmed in teleoperated is on the right. Both of them are placed exactly like that in those places not in any loops or case structures.

I have made the following changes…

Do you have a picture or jpeg of your code?

Thank you.





So if I understand you correctly you want the camera pan -10 degrees when button 3 is pressed, pan +10 when button 4 is pressed, and return to zero degrees when the driver lets go of either button? If this is indeed what your after then all you need to do with the code from your last screen shot is this. For each axis you have 2 case structures, drag a new case structure around both of them so that they are nested inside the true case, then wire a branch from each button to a boolean OR to the trigger of that case structure. what that does is once either button is pressed it allows the value of whichever button was pressed to be passed to your current code. then in the false case of the new case structure use a servo set angle to 0. so that when the button goes false (released) the servo returns to zero. the reason you cant just add it to the false cases you already have is that when you press button 4, button 3 is still false and commanding 0, while button 4 is commanding 10, you can see the conflict right? I don’t have labview here so I can’t take a screen shot. hope this helps.