![]() |
Button help
This is my first year programing and our team needs help programing buttons. We are looking to be able to run a CIM motor using imput from the joysticks but have run into some problems.
How can we get it so that the motor spins 360 degrees when the button is pushed and resets after the button is pushed. We don't want to hold down the button to have the motor go but have the motor go with one push of the button. Is is possible for us to get any examples of this? Also how do we set up initializing the motor and joystick with the begin vi? There is some confusion among our team about how the main code flows and initializes and finishes things since the main project is different visually from last year. Do we have to set up each joystick in the Begin vi and add the motor there? Do we have to put our teleop code inside the case structure or can we leave it in the execute loop outside the case structure? Thanks. |
Re: Button help
The green comment to the left of the Robot Main loop gives some guidance, and so do the comments on the subVIs.
To follow the flow that was intended, place the code inside of the Teleop SubVI. This will help to keep the code more structured and will help to ensure that the initialization, execution, and finalization happen correctly. So to repeat the comment, Begin is the appropriate place to put joystick and motor Opens and store them with a name. Teleop can then read the refnums by name and use them to drive the robot. Finish can Close them. Greg McKaskle |
Re: Button help
Okay then do we use the joystick refnum in teleop to get them initialized instead of the joystick open since that was already done in the begin.vi?
|
Re: Button help
Yes. Open once, and store with a name in Begin. Get with the name everywhere you need the value.
Greg McKaskle |
Re: Button help
Okay in the begin.vi do we then wire the joystick and motor up to the build array function?
|
Re: Button help
The errors are collected in a array. This makes it easy to see if anything is failing during initialization. You can do this if you like, but it isn't required. The errors will be reported to the Diagnostics page instead if they aren't wired.
Greg McKaskle |
Re: Button help
1 Attachment(s)
Okay we have the basic idea set up for pressing the button done and everything checks out, but when we deploy it to the robot nothing goes. Do we have to designate something else or what's not going on?
Here's an attachment of the teleop with buttons anything out of place that stopping the motor from running? |
Re: Button help
The Motor Open needs to be moved to Begin.vi and done the same way that all the other devices are opened.
What's happening is you are opening the motor 50 times a second and never closing any of them. LabVIEW is very confused about which of the several thousand motors you have opened you're talking about... |
Re: Button help
Thanks for helping everyone, the motor's running great now!
|
| All times are GMT -5. The time now is 11:05. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi