2 Replies Latest reply on Mar 3, 2020 10:23 PM by yiar_4652736

    CapSense One Button code with multiple buttons




      I currently have CY8CKIT-046 and trying example codes that I found on the Internet. In TopDesign section, I added a second button which has exactly same Widget Details as the first. Also ports are configured and main.c file has been edited just like the first button that is in the example code. I built the code and programmed. In CapSense Tuner, device is connected and everything looks OK. But when I try to press the buttons, one of them isn't working at all. Example code works by itself.


      What should I do?




      P.S: The attached file below is the example code.

        • 1. Re: CapSense One Button code with multiple buttons

          Hi yiar_4652736,


          I see that you have added the example code to the attachments and not your project. Please share your project so that we can see the issue.


          In the meantime, please note the following which could solve your issue.

          CapSense_SetWidgetExt() only configures a particular to be scanned. This API needs to be followed by CapSense_Scan() to initiate a scan. In case you want to scan the second button, wait for the scan of first button to complete and then configure the second button using CapSense_SetWidgetExt()  and perform the scan using CapSense_Scan() .




          uint8 i =0 ;







          if(CapSense_IsBusy() == 0)




               if(i > 1)

                    i = 0;

               CapSense_SetupWidgetExt(i,0); // Assuming there is only one sensor per widget.




          Calling CapSense_SetupWidgetExt() one after the other will scan only the last widget that was setup using  CapSense_SetupWidgetExt().


          Reference: CE210291_CapSense_P4_One_Button01 modify to multiple Buttons / Sense?




          1 of 1 people found this helpful
          • 2. Re: CapSense One Button code with multiple buttons

            Hi BragadeeshV_41,


            Thanks for both your answer and your reference, they do work!