Easiest is to remember the state of the button and react only when its state changes. When the button is pressed for a longer time (a counter will help to detect) you can react differently as fast forward, mute or something else.
oh. okay Bob.Thank you. I will try it out
Bob, could you please elaborate how to save the button state? I tried it out but still it is not executed only once. I tried varying the debounce settings of capsense too..still not working
1 of 1 people found this helpful
It has nothing to do with the debouncing of the capsense. Your code shows clearly "As long as the button is pressed execute the prev() function"
You have to define a
static uint8 Button_Pressed = FALSE;
and in code
if(CapSense_CheckIsWidgetActive(CapSense_BUTTON1__BTN) && !Button_Pressed)
Button_Pressed = TRUE;
if(Button_Pressed) LCD_PrintString("OFF ");
Button_Pressed = FALSE;
Might be you have to #define FALSE and TRUE as
#define FALSE 0
#define TRUE !FALSE
Thanks a lot Bob!...It is working.