|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
button activation for motor
We are trying to program two motors in labview to run by pressing buttons on the joystick.
can anyone help us out? |
|
#2
|
|||||
|
|||||
|
Re: button activation for motor
Please describe in detail exactly what you want to do. The more information you give about your goal, the more helpful will be the answers you receive.
What kind of motors? Which way do you want them to turn? Are the motors completely separate, or does the action of one depend on the action of the other? Will you be wiring the motors to a Spike, a Victor, or a Jaguar? Which joystick buttons do you want to use? Do you want them to run only while the buttons are pressed and stop when the buttons are released, or will you have a "start" button and a "stop" button? As you can see, there are a lot of things that will make a difference. Pin them down for us and we can give you plenty of useful advice. |
|
#3
|
|||
|
|||
|
Re: button activation for motor
Well, we can use any buttons, but we think it simple enough to go with buttons numbered one and two.
The goal of this is to have two motors, which are attached to wheels (for a total of two separate motors and two separate wheels), spin and launch a soccer ball, similar to those tennis ball launchers. We want the buttons set up so that the motors activate when button #1 is pressed, and then continue running until button two is pressed. The motors (CIM motors) are directly attached to the wheels (no chain or anything) and need to spin in opposite directions. We will be wiring them to jaguars. |
|
#4
|
||||||
|
||||||
|
Re: button activation for motor
What happens if button 2 is pressed before button 1? What happens when button 1 is released? What happens when button 2 is released? What happens when button 1 and button 2 are pressed at the same time?
|
|
#5
|
|||
|
|||
|
Re: button activation for motor
Well, pressing number 2 only stops the motor. if it isn't started already, then nothing happens. nothing is initiated from the releasing of button 1. its just the pressing that activates the motor. same thing with button number two, except with stopping it. when they are pressed at the same time, well i hadn't figured that in so i don't know.
|
|
#6
|
||||
|
||||
|
Re: button activation for motor
It sound like a simple "State Machine" will do the trick.
Default it so that a "0" value is sent to both Victors. Then when button 1 is pressed, a 1 is sent to one victor and a -1 is sent to the other. Have this second state look for button 2 to be pressed. If 2 is not pressed, it stays in this state. Once button 2 is pressed, it switches state back to the first, default, state. The last bit of logic you might want to apply is to prevent the pressing of both buttons 1 and 2 at the same time from causing a problem. To do this, place an AND gate in line with button 1, then put an inverter between button 2 and the second input on the AND gate. The output of the AND gate will go into the state machine as the button 1 input. |
|
#7
|
|||
|
|||
|
Re: button activation for motor
well we aprieciate all the help, but we need to know what labview will look like to make this work.
|
|
#8
|
|||||
|
|||||
|
Re: button activation for motor
Quote:
Do you know how to set the speed of a motor connected to a Jaguar? Do you know what a Case block is in LabVIEW? What program will you be starting with? Will this program need to do anything besides controlling the two motors? |
|
#9
|
||||
|
||||
|
Re: button activation for motor
Quote:
Let's start off with my favorite site for learning LabView from an FRC perspective. There are a couple different links into the site that work, but this is my favorite. This is on the LVMastery web site. I'll bet by the time you run through the first 14 lessons, you will be able to answer your own question. Do your self a big favor and don't stop after #14, finish them all. It will be well worth your time. |
|
#10
|
|||||
|
|||||
|
Re: button activation for motor
Assuming the answers to the first three questions I posed a couple of posts ago are all "yes":
Open the joystick and both motors in the Begin vi, giving them useful names with RefNum Set functions. Close them all in the Finish vi. Put two Case blocks in the Teleop vi. Wire the "Buttons" output of a Joystick Get to an Unbundle By Name and choose the two buttons you want to use. Wire the state of the first joystick button to the selector terminal of the first Case block. Inside the "True" case, set both motors to run at the desired speed. Leave the "False" case empty. Wire the state of the second joystick button to the selector terminal of the second Case block. Inside the "True" case, set both motors to stop. Leave the "False" case empty. This will do exactly what you asked for, including the part about not being sure what happens when both buttons are pressed simultaneously. |
|
#11
|
|||
|
|||
|
Re: button activation for motor
Thank you so much this helped tremendously.
|
|
#12
|
||||
|
||||
|
Re: button activation for motor
That is exactly why we are here. Please feel free to ask if you need any additional help.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Joystick Button Motor!!! HELP!!! | furiousgeorge | Programming | 3 | 07-02-2009 22:57 |
| using a switch/button to turn on a motor | smcmahon | NI LabVIEW | 3 | 26-01-2009 18:42 |
| How do I Link a (group of) Joystick button(s) to a motor? | CardcaptorRLH85 | C/C++ | 2 | 22-01-2009 23:23 |
| Reset Button for Vex RC's | irishninja | FIRST Tech Challenge | 5 | 18-06-2006 15:56 |
| White Paper Discuss: Approx. Motor Spec for Taigene Motor | Joe Johnson | Motors | 2 | 22-01-2005 16:36 |