|
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.
|