Go to Post Oh, the magic smoke will just make make it seem a bit more like Christmas. - CJO [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 10-02-2013, 09:31
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is online now
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,664
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: Window Motor Problem?

Quote:
Originally Posted by cdizzle View Post
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?
Quote:
Originally Posted by nicholsjj View Post
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.
If you have two completely separate case blocks for button 3 and 4, then yes, the false case in the button 3 block will affect button 4 even if button 4 is true. See my attached snippet. The top two show the cases in the case blocks. The bottom shows what will run when button 3 is false and button 4 is true. Both of those case blocks will run, which means you're trying to set the motor speed to 0 and set the motor speed to 0.9 at the same time. The results of trying to set the motor to two different speeds simultaneously are not particularly predictable.

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.
Attached Thumbnails
Click image for larger version

Name:	Bad Motor Snippet.png
Views:	12
Size:	30.3 KB
ID:	13914  
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter

Last edited by Kevin Sevcik : 10-02-2013 at 09:48.
Reply With Quote
  #2   Spotlight this post!  
Unread 10-02-2013, 19:50
cdizzle cdizzle is offline
Registered User
FRC #2367
 
Join Date: Oct 2012
Location: Bay Area, CA
Posts: 42
cdizzle is an unknown quantity at this point
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.
Reply With Quote
  #3   Spotlight this post!  
Unread 10-02-2013, 02:36
Cecil's Avatar
Cecil Cecil is offline
Registered User
AKA: Alex Hummel
FRC #2010 (Lightning Bots)
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2006
Location: Champion
Posts: 343
Cecil is a splendid one to beholdCecil is a splendid one to beholdCecil is a splendid one to beholdCecil is a splendid one to beholdCecil is a splendid one to beholdCecil is a splendid one to beholdCecil is a splendid one to behold
Re: Window Motor Problem?

Quote:
Originally Posted by Kevin Sevcik View Post
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.
What I've always done is just put the numbers in the case statements, with the Set VI outside the case. The true cases have the values to set the motor to, and the false cases both have 0 in it. Just to the right of the case, I put an addition operator in. That way, if one button is pressed, it adds 0, not affecting the output. 0+0 = 0, x+0 = x, and x+y=0. (Of course, this only works when both positive and negative values are the same...)

Edit: I also use the Select statement for the values, not just cases. Keep forgetting I usually put global sets in there too.
__________________
I'm right 90% of the time, so why worry about the other 3%?
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:54.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi