Go to Post It doesn't take money, just desire. - BillP [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 10-03-2011, 18:57
Team 2524 Team 2524 is offline
Registered User
FRC #2524
Team Role: Programmer
 
Join Date: Feb 2011
Rookie Year: 2011
Location: New York
Posts: 48
Team 2524 is an unknown quantity at this point
Checking Rookie Programmer's code to switch between motors

Unfortunately, the first time I attempted to use a case structure to run the robot, it didn't work. We didn't have much time to program

Our team needs to be able to switch motor controls and I was wondering if this is the correct way of doing the code. We need to be able to press a button (only once) and it would switch the motor control. Press it once more to switch back to the original motor control.

Thank you so much.

This is in telop VI
Attached Files
File Type: vi Double Check.vi (11.3 KB, 11 views)

Last edited by Team 2524 : 10-03-2011 at 19:00.
Reply With Quote
  #2   Spotlight this post!  
Unread 10-03-2011, 19:38
Vikesrock's Avatar
Vikesrock Vikesrock is offline
Team 2175 Founder
AKA: Kevin O'Connor
no team
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2007
Location: Manchester, NH
Posts: 3,305
Vikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond repute
Send a message via AIM to Vikesrock Send a message via MSN to Vikesrock Send a message via Yahoo to Vikesrock
Re: Checking Rookie Programmer's code to switch between motors

The posted code will activate the alternate function while the button is held. It will not toggle when the button is pressed.

For a toggle check out Team 358's Labview Examples page. There is an example there called "Button Toggle Action".

There is also an example provided with Labview. Click "Find FRC Examples" on the splash screen, look under "Joystick" and find "Joystick Button Latching"
__________________


2007 Wisconsin Regional Highest Rookie Seed & Regional Finalists (Thanks 930 & 2039)
2008 MN Regional Semifinalists (Thanks 2472 & 1756)
2009 Northstar Regional Semifinalists (Thanks 171 & 525)
Reply With Quote
  #3   Spotlight this post!  
Unread 10-03-2011, 19:46
rclothier rclothier is offline
Coach, Team 1723
AKA: Russell Clothier
FRC #1723 (The FIRST Bots of Independence, "The FBI")
Team Role: Coach
 
Join Date: Jan 2011
Rookie Year: 2006
Location: Independence, MO
Posts: 42
rclothier is on a distinguished road
Re: Checking Rookie Programmer's code to switch between motors

While there are certainly ways to make a single button push switch from one mode to another, the easiest thing (if I'm interpreting your code correctly) would be to just hold down Button 11. Otherwise, you'll have to add a shift register and/or global variable to keep track of when you press the button. You'd only want to change states when you just pressed the button, meaning a) the last time through, the button wasn't pressed, AND b) this time, the button is pressed. So you'd have to store what the button was the last time, recall it, compare it to what the button is this time, and only make a change when Last Time = False and This Time = True.
Reply With Quote
  #4   Spotlight this post!  
Unread 10-03-2011, 21:09
Team 2524 Team 2524 is offline
Registered User
FRC #2524
Team Role: Programmer
 
Join Date: Feb 2011
Rookie Year: 2011
Location: New York
Posts: 48
Team 2524 is an unknown quantity at this point
Re: Checking Rookie Programmer's code to switch between motors

It's going to be a much simpler code to just hold the button down. Our joystick 1 controls the arcade drive of the robot while 2 other joystick will be used for the arms. It's good for the CRIO so that it doesn't overload.

Thank you for your Gracious Professionalism
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 20:44.

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