View Single Post
  #3   Spotlight this post!  
Unread 10-02-2010, 07:54
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,112
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: Running Motor for X Milliseconds

It sounds like what you want is in three parts. First, start a motor running forward when a button is pressed. Second, stop the motor a certain amount of time after the motor is started. Third, if the motor isn't running forward, run it backward until a limit switch activates. Is that right?

You'll need a "rising edge detector" to find the start of the button press. Then you'll want something that runs the motor until a certain time has elapsed. The attached code fragment shows a way to do that.

I'll leave it up to you to figure out how to make the motor run the other way only when it's not being told to run forward and the limit switch is not active.
Attached Thumbnails
Click image for larger version

Name:	one-shot.jpg
Views:	42
Size:	30.2 KB
ID:	8600  
Reply With Quote