Long press Capsense activity

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
iammyur
Level 1
Level 1
10 sign-ins 5 sign-ins First reply posted

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
lock attach
Attachments are accessible only for community members.
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

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
lock attach
Attachments are accessible only for community members.
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

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

iammyur
Level 1
Level 1
10 sign-ins 5 sign-ins First reply posted

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
Level 1
Level 1
10 sign-ins 5 sign-ins First reply posted

Hi @Hari 

I not get my answer yet. Please help me !

 

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

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
Moderator
750 replies posted 500 replies posted 250 solutions authored

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
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

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