Get the status of 1 button when using CapSense in PSoC4

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

cross mob
Anonymous
Not applicable

Hello. Where can I read how to get the status of 1 button when using CapSense in PSoC4. In all examples only sliders and position finding.

I want to write a simple type code:

button = CapSense_GetButton(num_of_button);      // coined command

if (button != 0)

{

     // to do something

}

else

{

     do something different

}

In CapSenseCSD component datasheet I can not find the right command.

0 Likes
1 Solution
Anonymous
Not applicable

I am adapted https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjQvpi3ktbZ...

Its work)))))

int main()

{   

    CyGlobalIntEnable;

    CapSense_Start();

    CapSense_InitializeAllBaselines();

    for(;;)

    {     

        CapSense_UpdateEnabledBaselines();

        CapSense_ScanEnabledWidgets();

        while(CapSense_IsBusy() != 0)

        {

            //wait for the scanning

        }

            if (CapSense_CheckIsSensorActive(CapSense_SENSOR_BUTTON0__BTN))

            {

                LED_1_Write(0); /* enable LED */

            }

            else if(!CapSense_CheckIsSensorActive(CapSense_SENSOR_BUTTON0__BTN))

            {

                LED_1_Write(1); /* disable LED */

            }   

    }

}

View solution in original post

0 Likes
1 Reply
Anonymous
Not applicable

I am adapted https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjQvpi3ktbZ...

Its work)))))

int main()

{   

    CyGlobalIntEnable;

    CapSense_Start();

    CapSense_InitializeAllBaselines();

    for(;;)

    {     

        CapSense_UpdateEnabledBaselines();

        CapSense_ScanEnabledWidgets();

        while(CapSense_IsBusy() != 0)

        {

            //wait for the scanning

        }

            if (CapSense_CheckIsSensorActive(CapSense_SENSOR_BUTTON0__BTN))

            {

                LED_1_Write(0); /* enable LED */

            }

            else if(!CapSense_CheckIsSensorActive(CapSense_SENSOR_BUTTON0__BTN))

            {

                LED_1_Write(1); /* disable LED */

            }   

    }

}

0 Likes