| ??? 03/03/08 23:36 Read: times |
#151838 - Dual Switch Responding to: ???'s previous message |
Jan Waclawek said
And what shall happen if the press happens to be more
than 0.5 and less than 2.5 seconds long? Exactly! Otherwise I could have suggested:
{if (SW == On)
{DelayCounter = 0; //start counting
while(SW == On && DelayCounter <= 50) //wait switch release,max 0.5 Secs
{Delay(); // 10ms
DelayCounter ++; }
if (DelayCounter > 50 )
Longpress_Job();//if switch pressed longer than 0.5 secs, call Longpress_Job
Shortpress_Job(); //normal
Above can be modified for specific requirements. With best regards and while learning C A.S.Rudra |
| Topic | Author | Date |
| Dual function push button with timer in C? | 01/01/70 00:00 | |
| Interrupt | 01/01/70 00:00 | |
| No answer just another question: | 01/01/70 00:00 | |
| Nothing really, just those two functions. | 01/01/70 00:00 | |
| Dual Switch | 01/01/70 00:00 | |
| Ah yes....that will do | 01/01/70 00:00 | |
| discussed here | 01/01/70 00:00 | |
| Triple Function Even Possible | 01/01/70 00:00 | |
of course timer | 01/01/70 00:00 |



