Thread: button control
View Single Post
  #2   Spotlight this post!  
Unread 06-02-2008, 21:17
eaglesfan10's Avatar
eaglesfan10 eaglesfan10 is offline
Registered User
FRC #1647 (Iron Devils)
Team Role: Programmer
 
Join Date: Oct 2007
Rookie Year: 2005
Location: New Jersey
Posts: 19
eaglesfan10 is an unknown quantity at this point
Re: button control

You could set a flag and use a counter. It would probably look something like this:
static int flag = 0;
static int counter = 0;

if(button_pressed)
{
flag = 1;
}

if(flag && counter < some_number)
{
//your code
}
else
{
flag = 0;
counter = 0;
}
counter++;
I'm probably missing something, but that's the general idea. I think there are about 40 loop counts in one second.