2 Replies Latest reply on Aug 28, 2013 8:21 AM by userc_41927

    Different application with Capsense  button



      I want to get information for an application.I pushed capsense button, for example works motor. If I press the even longer same button works another motor. For example counter. When I pressed button for once, increase counter once, ı hold down same capsense button counter increase in tens. How should I do this with program. Thanks.

        • 1. Re: Different application with Capsense  button

          Basically you implement a time counter or a clock connected to an ISR. To


          differentiate how long you hold a button down, and based on time held


          implement different functions, like starting the alternate motor.




          So create a timer, say 100 mS, enable its interrupt, and each time ISR


          fires inc a time counter. Then in main() test the counter and based on its


          value action different tasks. When released you clear the time counter.




          Regards, Dana.




          • 2. Re: Different application with Capsense  button

            For controlling motors :--




            You can use a timer for this.




            As a button press is detected, start the timer . And as the button is released, stop the timer.


            Read the timer value.


            If it is more than a threshold value [selected by you, say 2 seconds] then motor2 is started. Else motor1 is started.