Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Toggling boolean using 2 limit switches (http://www.chiefdelphi.com/forums/showthread.php?t=73472)

Quarkster 02-02-2009 16:58

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?

Jared Russell 02-02-2009 17:05

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 :)

Burmeister #279 02-02-2009 22:43

Re: Toggling boolean using 2 limit switches
 
1 Attachment(s)
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


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

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