|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Window Motor Problem?
It seems like a coding problem, but I can't figure out what the problem is at all. We tried both a Victor and a Jaguar, so I don't think that is the problem. The code is very standard, I just wired two buttons to a case block. And for one of them, I ran the motor forward when it was true, and backward when it was false. The motor itself is upside down, so it doesn't work properly when the motor is turning forward, but it works well in reverse.
|
|
#2
|
|||||
|
|||||
|
Re: Window Motor Problem?
Quote:
|
|
#3
|
|||
|
|||
|
Re: Window Motor Problem?
Quote:
I have 2 case blocks. One case block is wired to button 3 on our joystick. When that case is true, it sets the motor speed to -0.9. That one works smoothly. I also have another case block which is wired to button 4 on our joystick. When that case is true, it sets the motor speed to 0.9. When I press that button, the motor moves in the right direction, but it stops and jerks forward and then stops again. Note that I haven't put anything in the false part of the case blocks. Thanks so much for your help and once again I'm really sorry that I can't post a screen shot right now. |
|
#4
|
|||||
|
|||||
|
Re: Window Motor Problem?
Quote:
What I like to do for programming two buttons to turn a motor is to pick a dominant case. That means that you pick one of the buttons that "wins" if both buttons are pressed. Then you can pretty easily use two Select blocks to set the motor speed. See my attached code snippet, in which button 3 "wins" and gets final say in the motor speed. |
|
#5
|
||||
|
||||
|
Re: Window Motor Problem?
You could try switching imput buttons on your joystick to see if that helps also. I know our gamepads had a glitchy button on it. You might want to put the -1 value and then invert that into you motor output to see if it works also.
|
|
#6
|
|||
|
|||
|
Re: Window Motor Problem?
Quote:
Quote:
![]() |
|
#7
|
||||
|
||||
|
Re: Window Motor Problem?
[quote=cdizzle;1230855]Wait, so if I set my motor speed to 0 when false in the case block for button 3, will it affect the motor when the button 4 case block is true?
No it should just affect the output from case three. My next question is are you sending both button outputs into the same motor set output vi. This might be where Kevin's statement about overriding can occur if you use two different vi's. |
|
#8
|
|||||
|
|||||
|
Re: Window Motor Problem?
Quote:
Quote:
Cecil's suggestion of putting the motor set block outside of the cases is also a good one. Then you know that you only have one motor set and it's only going to run once. Then you just have to figure out how to send it the appropriate value. It makes it pretty obvious if your value selection method isn't valid because you'll end up trying to wire two thing to the same input, which labview will complain about. Last edited by Kevin Sevcik : 10-02-2013 at 09:48. |
|
#9
|
|||
|
|||
|
Re: Window Motor Problem?
I got it working! Thanks for your help guys! I think something was overriding the reverse command, but I couldn't figure out what it was, so I just wired it to one SetMotorSpeed like you guys said to.
|
|
#10
|
|||||
|
|||||
|
Re: Window Motor Problem?
Just as long as you remember this and apply that design pattern to the rest of your systems so you don't have the same problem in the future.
|
|
#11
|
||||
|
||||
|
Re: Window Motor Problem?
Quote:
Edit: I also use the Select statement for the values, not just cases. Keep forgetting I usually put global sets in there too. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|