PICcoder.co.uk Forum  


::post new topic::
processing button click
Date: 2006/10/07 10:17 By: unit Status: User  
Karma: 0  
Posts: 4
graphgraph
I try to handle button click by following code

Code:

  #define BUTTON1 RA0 // pushed - 0, released - 1 #define LED1 RA1     LED1 1// turn LED on start    :         if (BUTTON1 == 0//pushed     {             DelayMs(100); // delay for 100 milliseconds             while (BUTTON1 == 0)             { //wait while pushed             }                 DelayMs(100); // delay for 100 milliseconds             LED1 = !(LED1); // turn LED on/off     }          goto start;



But there are some stuff that I didn't take into account, and therefor it works wrong. Sometimes when I click the button LED don't torn off/on. And sometimes LED switches when I do not touch the button.


P.S. Sorry for my terrible english
reply | quote

Re:processing button click
Date: 2006/10/07 12:29 By: unit Status: User  
Karma: 0  
Posts: 4
graphgraph
The problem was sloved. (I forget to turn off watchdog timer)
reply | quote

::post new topic::