Go to Post I think one of they beauties of the program is how it can include so many different interests our students have. - Doc Wu [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
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 01-08-2012, 22:31
gabrielc97's Avatar
gabrielc97 gabrielc97 is offline
Registered User
AKA: Gabriel
FRC #4029 (Spartan Bots)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Huntington Park CA
Posts: 39
gabrielc97 is an unknown quantity at this point
Question How to program two buttons to control the same motor.

Hello! we were trying to program two buttons to control a CIM motor. one button gives the motor a value of 1, and the other gives the motor a value of 0.6. every time that we push the first button, it moves perfectly. however, when we push the second button, it stutters, and spins ridiculously slow. we know that it is not the number because on another test with the same values, the button that gives the motor a value of 0.6 works and the motor spins at 60% of the original speed. the other button is now the one that stutters or sometimes doesnt run at all. if anyone can help, we would really appreciate it.

Thanks!
__________________
Gabriel
Reply With Quote
  #2   Spotlight this post!  
Unread 01-08-2012, 22:43
plnyyanks's Avatar
plnyyanks plnyyanks is offline
Data wins arguments.
AKA: Phil Lopreiato
FRC #1124 (The ÜberBots), FRC #2900 (The Mighty Penguins)
Team Role: College Student
 
Join Date: Apr 2010
Rookie Year: 2010
Location: NYC/Washington, DC
Posts: 1,114
plnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond repute
Re: How to program two buttons to control the same motor.

It sounds like your implementation is causing multiple (different) values to be set to the motor during one iteration of your code.

You'll also want to determine which button you want to have priority (if both are pressed, what speed do you want the motor to spin at?). Then, you can either use a case structure or two select nodes to choose the motor speed, which you would then wire into a motor set VI. Try and write the code so that there's only one instance of the Motor Set VI controlling the motor.
__________________
Phil Lopreiato - "It's a hardware problem"
Team 1124 (2010 - 2013), Team 1418 (2014), Team 2900 (2016)
FRC Notebook The Blue Alliance for Android
Reply With Quote
  #3   Spotlight this post!  
Unread 01-08-2012, 22:45
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: How to program two buttons to control the same motor.


http://www.chiefdelphi.com/forums/at...7&d=1329451162
Reply With Quote
  #4   Spotlight this post!  
Unread 05-08-2012, 21:57
Brandon_L Brandon_L is offline
Back @ it again with the white vans
AKA: Brandon Liatys
FRC #2180 (Zero Gravity)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Newark, NJ
Posts: 1,207
Brandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond repute
Re: How to program two buttons to control the same motor.

To add some background to what the above posters said, it sounds like you used two different motor set output VIs for the same motor. The code resulted in one being supplied with a 0 value, and the other with a 1 or 0.6. This will cause it to rapidly stop and start (in a matter of milliseconds) giving it the "sputtering" effect you described.

When controlling a motor, its always best to have a single "Motor Set Output" VI per motor, and manipulating the number being input into the VI through code such as Ether provided. If you stick to this simple rule of thumb of only one VI per motor, you'll never have two values "fighting" each other and giving this effect.

You can use the "Highlight Execution" button in Labview (the icon with the lightbulb) and run your code to literally watch what happens in slow motion. This is a pretty handy debugging tool.
__________________
FRC 2495 - Hamilton West Robotics [2007-2014] - whats a..."hive mind"?
FRC 3929 - Atomic Dragons [2012-2013]
FRC 2180 - Zero Gravity [2017-]

Just trying to collect all the possible team colors
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 21:51.

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