View Single Post
  #2   Spotlight this post!  
Unread 24-01-2013, 18:17
propionate's Avatar
propionate propionate is offline
Team co-lead and LabVIEW programmer
AKA: Stephen
FRC #1732 (Hilltopper Robotics)
 
Join Date: Jan 2012
Rookie Year: 2009
Location: Milwaukee
Posts: 93
propionate is on a distinguished road
Re: Help on programming a limit switch

I haven't done something like this before, so someone will have to double-check this solution, but I believe the following code will achieve your goal:

Begin.vi:
http://i.imgur.com/H3hoOoh.png

Teleop.vi:
http://i.imgur.com/xTD6a8s.png

Finish.vi:
http://i.imgur.com/5cQGowS.png


The Teleop routine takes place in three steps (working from top to bottom). When the trigger on the joystick is pressed, the arm begins to move at half speed and releases the first limit switch. When the arm hits the second limit switch, the code will compare the previous state of the limit switch to its current one. If those states are different (the switch has been tripped), the arm will begin to move back towards the first limit switch. Finally, when the arm reaches and trips the first limit switch, the motor will be turned off. I created this off the top of my head, so I am sure Greg McKaskle will be along soon to point out the flaws (or unnecessary complexities).

Best of luck.
Reply With Quote