View previous topic :: View next topic |
Author |
Message |
stef.df
Joined: 02 Apr 2009 Posts: 2
|
How to add a timer? |
Posted: Thu Apr 02, 2009 7:56 pm |
|
|
Hi, can someone help me solve my problem.
My program is like:
Code: |
if( input(PIN_C3)== true)
{ do............
}
else
{do..........
}
|
What I want to do now is add a timer so that when PIN_C3 is high, go to the if loop. When PIN_C3 turn to be low, after 1min go to the else loop. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Apr 02, 2009 9:21 pm |
|
|
The easiest way to delay for 1 minute, if the program doesn't have to
do anything else during that time, is to do this:
|
|
|
Guest
|
|
Posted: Thu Apr 02, 2009 11:21 pm |
|
|
PCM programmer wrote: | The easiest way to delay for 1 minute, if the program doesn't have to
do anything else during that time, is to do this:
|
during the 1 min, still need to be in the if loop-.- after 1min jump to the else loop. |
|
|
|