cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

iammyur
New Contributor II

Hi. @MotooTanaka @BragadeeshV 

How can i use one capsense button with two event . Example if i am pressing capsense for 5 sec it will work for event number 2 @

0 Likes
1 Solution
Hari
Moderator
Moderator

Hi @iammyur 

 

You can do this with the help of a timer block. I am attaching a project that calls 2 functions based on the CapSense status. A short press will call Function1 and a long press (of 5 seconds) will call function2. I have prepared this for the 145-40XX kit, but you can port it to any device.

 

Best regards, 
Hari

View solution in original post

6 Replies
Hari
Moderator
Moderator

Hi @iammyur 

 

You can do this with the help of a timer block. I am attaching a project that calls 2 functions based on the CapSense status. A short press will call Function1 and a long press (of 5 seconds) will call function2. I have prepared this for the 145-40XX kit, but you can port it to any device.

 

Best regards, 
Hari

View solution in original post

iammyur
New Contributor II

Hi @Hari 

Thank you for this.

Now my question is when i pressing button for 5 sec. it will call function 2 .  After sometime (5 to 10 Sec.) . if i am pressing button for short time it will automatically come back to function 1 ?

 

0 Likes
iammyur
New Contributor II

Hi @Hari 

I not get my answer yet. Please help me !

 

0 Likes
MotooTanaka
Esteemed Contributor

Hi,

I not get my answer yet. Please help me !
I wonder if Hari-san's sample above did not work for you?

moto

0 Likes
Hari
Moderator
Moderator

Hi @iammyur 

 

If you have a lift off, that is, after 5 seconds if you remove your finger and then place it for a short period, it will call function 1 again. 

 

Best regards, 
Hari

0 Likes
MotooTanaka
Esteemed Contributor

Hi,

First of all, I have never tried such CapSense usage, 

so the followings are my idea.

If I were you, I would start timer (time count), probably using the SysTick, and count time till the button is released.

And if the button is released before 5 sec arrives, I trigger the event number 1,

or if 5 seconds expires, I trigger the event number 2.

Note: At this point, I don't know if I should trigger the event number 1 at the time the button was touched,

or I should wait until the button is released or kept longer than 5 secs.

moto

0 Likes