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

Simple Proximity Sensor Demo using Cy_CapSense_IsProximitySensorActive API on PSoC6 for MTB2.2

Kenshow
Level 8
Level 8
50 solutions authored 25 solutions authored 10 solutions authored

Hello,

Turn the LED on/off using the Cy_CapSense_IsProximitySensorActive () function provided for Proximity based on the Simple Proximity Sensor Demo posted earlier

The previous CE was a program that brightened and darkened the LED according to the distance. When using proximity sensing to turn the switch on and off, it is easy to use the provided Cy_CapSense_IsProximitySensorActive () function.

The program in the main.c file has been changed as follows.

  -------------

static void process_touch(void)

{

    uint32_t prox_status;

    static led_data_t led_data = {LED_ON, LED_MAX_BRIGHTNESS};

    prox_status = Cy_CapSense_IsProximitySensorActive  (

                CY_CAPSENSE_PROXIMITY0_WDGT_ID,

                        CY_CAPSENSE_PROXIMITY0_SNS0_ID,

                        &cy_capsense_context);

    if((prox_status & 0x3) == 0){

        led_data.state=LED_OFF;

    }

    else

    {

        led_data.state=LED_ON;

    }

    update_led_state(&led_data);

}

  ------------

 Please use the one of Simple Proximity Sensor Demo (TARGET_CY8CKIT-062-BLE.zip) for CapSense and peripheral settings. Only the project is attached here.

Thanks,
Kenshow

1 Reply
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hello Kenshow-san, 

 

Thank you for sharing this project with the community.  Appreciate your effort in creating this...

 

Best regards, 
Hari

0 Likes