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


      Topics Author Date
    thread link
processing button click
unit 2006/10/07 10:17
    thread link
thread linkthread link Re:processing button click
unit 2006/10/07 12:29
::post new topic::