View Single Post
  #4   Spotlight this post!  
Unread 14-02-2013, 18:18
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: 3 Stage Motor Control

I've attached some code I created that should do what you're looking for. A few important things about it:

1. The case structure on the left should be in teleop with the case selector wired up to your driver's station input (button I presume).
2. The case structure on the right should be in periodic tasks. I think it would be best to put it here because it will let you feed frisbees into your shooter in autonomous as well with minimum additional code.
3. The "Feed Frisbee" local variable should be a global variable in your code.


The case structure on the right will use the elapsed time (once the button is pressed) to run the motor forward at .5 for one second, then backwards at .5 for one second. It will then return itself to the false case to await another button press.


Edit: I just realized this could be done with less code using a flat sequence. I'm not a fan of them personally, but if you want to take that route, just modify the code in the image below to run your motor for the desired amounts of time.

http://team358.org/files/programming...imedAction.jpg
Attached Files
File Type: vi Motor Forward.Backward.Stop.vi (13.7 KB, 5 views)

Last edited by propionate : 14-02-2013 at 18:24.
Reply With Quote