Thread: Switch help
View Single Post
  #8   Spotlight this post!  
Unread 22-01-2014, 10:52
nelson.ke@ nelson.ke@ is offline
Registered User
FRC #2883
 
Join Date: Jan 2012
Location: United States
Posts: 6
nelson.ke@ is an unknown quantity at this point
Re: Switch help

Quote:
Originally Posted by Alan Anderson View Post
That's going to involve something a little more complicated than simple combinatorial logic. I suggest implementing it as a flat sequence in Periodic Tasks.

In the first frame, halt the motor and wait for the trigger to be released. In the second frame, halt the motor and wait for the trigger to be pressed. In the third, set the motor to whatever value you want it to run at and wait for the limit switch to be activated. Put the entire sequence in a neverending while loop so it starts over every time it finishes.

The "wait for" parts can be programmed as while loops that terminate when the condition is seen. Make sure to put a delay inside each of those loops so they don't monopolize the cRIO's CPU.

If this isn't enough to start with, let me know and I'll give you some example code to look at.
I know only a little about labview, so I found the while loops and flat sequences and understand what you're saying. However, I'm not understanding how to program it. Can you send a pick of what you would do, like a pic of the program?

Thanks!
Reply With Quote