Thread: Commands
View Single Post
  #8   Spotlight this post!  
Unread 05-02-2007, 18:55
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: Commands

Quote:
Originally Posted by Barchechath View Post
I some need kind of delay because when i press the button once the robot doing the open and close command too fast.
And that is why i am searching for a delay of something like two seconds.
If I understand your needs properly, Eric is correct: what you want is a counter. Process_Data_From_Master_uP() is executed about every 26 milliseconds. Check the state of the button in that routine (or in another routine called from it). If the button is pressed, increment the counter; if the button is not pressed, set the counter to zero. If the counter reaches 76, you know the button has been held for two seconds, and you can take some action.

If that doesn't sound like what you need, please give some more detail about what you want the button to do.