08-07-2013 12:53 PM
Hello,
I've been trying to get a single servo to move between four different angles, staying at each angle for a given amount of time. I've had some luck using timed sequences but my servo is acting wild because (I'm guessing) there's an argument between which angle it should be at. Is there any easy way to make a command (i.e 'write servo angle') run for a specified amount of time and then stop and proceed to the next command?
I've attached a screenshot of my block diagram.
Thanks in advanced.
08-08-2013 11:23 AM
Hi Matt,
Instead of using while loops, you should be able to use a simple state machine to tell the motor to when to move to a certain position. Once the move motor command has been called, the motor will hold that position until another move command is called.
What is happening in your current code is that the motor is being told to move to position 15 every time the inner loop executes, so if it is off by even a little bit it will overcorrect which is what is probably causing the strange behavior you are seeing,
-N
08-08-2013 12:02 PM
what exactly is a simple state machine? sorry i'm very new to this.
08-08-2013
12:16 PM
- last edited on
08-06-2024
06:30 PM
by
Content Cleaner
Hi Matt,
Here's some documentation on a state machine:
Basically what you want to do with this code is start up in an idle state, then move to a location and return to your idle state. Wait in this idle state until a timer has expired, then after that occurs, command the motor to move to the next position. You might want to look into some of the LabVIEW training, there is a 3-hour and 6-hour getting started courses that can be found here: