Go to Post TIME is the one commodity you cannot buy more of. - Andy Brockway [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 02-02-2009, 16:58
Quarkster Quarkster is offline
Registered User
FRC #2729
 
Join Date: Jan 2009
Location: New Jersey
Posts: 4
Quarkster is an unknown quantity at this point
Toggling boolean using 2 limit switches

My robot has 2 limit switches. I want a certain value to be positive or negative depending on which of the switches was hit most recently. How would I do that?
Reply With Quote
  #2   Spotlight this post!  
Unread 02-02-2009, 17:05
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,071
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Toggling boolean using 2 limit switches

This is how I would do it in C:

Code:
boolean myBool = false;

if( switch1 )
  myBool = true;
else if( switch2 )
  myBool = false;

// If neither switch is pressed, then myBool keeps its old value
Making a VI out of that is left as an exercise to the reader
Reply With Quote
  #3   Spotlight this post!  
Unread 02-02-2009, 22:43
Burmeister #279's Avatar
Burmeister #279 Burmeister #279 is offline
What Time Is It?
AKA: Nick Burmeister
FRC #0279 (TechFusion)
Team Role: Programmer
 
Join Date: Nov 2008
Rookie Year: 2007
Location: Toledo
Posts: 207
Burmeister #279 is a glorious beacon of lightBurmeister #279 is a glorious beacon of lightBurmeister #279 is a glorious beacon of lightBurmeister #279 is a glorious beacon of lightBurmeister #279 is a glorious beacon of lightBurmeister #279 is a glorious beacon of light
Send a message via AIM to Burmeister #279
Re: Toggling boolean using 2 limit switches

i can help make the VI for you or show you at least how it should be done but i need to know which limit switch you want to use to make the value positive. its complicated because i don't know if the value is, say 1, or if its a changing value. generally if its a motor you can use either selectors or multiple Case structures to choose your value.

[edit] i've made a simple series of cases here that should help you along. if you still can't figure it out, i'll be back on between 3-4 or 9ish
Attached Files
File Type: vi two button flip values.vi (18.9 KB, 46 views)
__________________
WHAT TIME IS IT? TWO SEVEN NINE!!! [Team B =) ] Awards: 4 Safety, 2 Ind. Design, 2 Xerox, 1 Nat. Champs
2009 Buckeye Semi-Finalists (1014 & 695) || 2008 GLR Safety Award || 2006 GLR Safety Award
2005 Buckeye Regional Champs (67 & 274) & GM Industrial Design Award & Safety Award GLR Quarter Finalist & Xerox Creativity Award & Safety Award National Xerox Creativity Award & Curie Quarter Finalist (1126 & 180)
2004 Buckeye Delphi Driving Tomorrows Technology Award & Quarter Finalist GLR Champs Nationals Curie Division Finalist
2003 GLR GM Industrial Design Award || 2001 National Newton Division Winner & National Champions
2000 MI DaimlerChrysler Team Spirit Award

Last edited by Burmeister #279 : 02-02-2009 at 22:52.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Limit switches(in C++) beefy1 Programming 3 24-12-2008 15:27
Using Limit Switches with the Arm iwin2000 Programming 3 18-02-2008 03:52
Limit Switches ChrisR_522 Programming 2 25-01-2008 08:04
limit switches stephenthe1 Programming 28 11-05-2005 16:37
Limit switches Team168 Programming 8 10-02-2003 16:22


All times are GMT -5. The time now is 08:04.

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