View Single Post
  #2   Spotlight this post!  
Unread 15-02-2013, 11:15
BenGrapevine's Avatar
BenGrapevine BenGrapevine is offline
Head Programmer
AKA: Tony Simmering
FRC #2549 (Millerbots)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Minneapolis, Minnesota
Posts: 46
BenGrapevine is an unknown quantity at this point
Re: 3 Stage Motor Control

Quote:
Originally Posted by propionate View Post
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
Thanks! I completely forgot about using timed tasks. I'll be sure to check everything out
__________________
Millerbots Team 2549
orange and blue
Reply With Quote