View Single Post
  #2   Spotlight this post!  
Unread 08-02-2014, 00:51
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Waiting Until Limit Switch Is Pressed

Quote:
Originally Posted by Wildcats1378 View Post
I am writing a piece of code for our shooter that will continue moving a motor until it hits a certain limit switch, and then continues onto the next frame...
How might this be accomplished?
You mentioned a flat sequence, so I assume you're using LabVIEW.

Just put a while loop in the frame, reading the limit switch inside the loop and using the returned value as the termination condition for the loop. It'll keep looping until the switch is activated. Be sure to also put a 10 ms delay (or thereabouts) inside the loop so it doesn't use up all the CPU cycles just waiting for the switch.

Quote:
Originally Posted by virtuald View Post
I would recommend hooking the limit switch up to the Jaguar, so it automatically turns itself off. No code required.
In this case, code is definitely required. This is a sequence of events that waits at one step until the switch is hit, so the program needs to be reading the switch.