Ashok R
Published

PSoC4 - Touch Me Not Car

This project demonstrate the working of CapSense with fun.

EasyShowcase (no instructions)4 hours250
PSoC4 - Touch Me Not Car

Things used in this project

Story

Read more

Schematics

Schematic

Code

Main

C/C++
/* ========================================
 *
 * Copyright YOUR COMPANY, THE YEAR
 * All Rights Reserved
 * UNPUBLISHED, LICENSED SOFTWARE.
 *
 * CONFIDENTIAL AND PROPRIETARY INFORMATION
 * WHICH IS THE PROPERTY OF your company.
 *
 * ========================================
*/
#include "project.h"

int main(void)
{
    CyGlobalIntEnable; /* Enable global interrupts. */

 /* Initialize the input - CapSense block */

    /* 1. Enable Proximity sensor as it is disabled by default */
    CapSense_EnableWidget(CapSense_PROXIMITYSENSOR0__PROX);

    /* 2. Start CapSense block - Calibrates the proximity sensor for the set sensitivity setting (in the Scan Order tab of Component Configuration */
    CapSense_Start();

    /* 3. Initialize Proximity baseline */
    CapSense_InitializeSensorBaseline(CapSense_PROXIMITYSENSOR0__PROX);
    CapSense_InitializeSensorBaseline(CapSense_PROXIMITYSENSOR1__PROX);
    //PWM_Start();

    for(;;)
    {
        if(CapSense_IsBusy() == 0)
        { 
             /* Update proximity sensor baseline */
            CapSense_UpdateSensorBaseline(CapSense_PROXIMITYSENSOR0__PROX);
            CapSense_UpdateSensorBaseline(CapSense_PROXIMITYSENSOR1__PROX);
            /* Check if proximity sensor is active - thresholds are dynamically calculated during run-time
                proximityActive variable will have a non-zero value if Proximity was active */
              uint8_t value1  = CapSense_CheckIsSensorActive(CapSense_PROXIMITYSENSOR0__PROX);
              uint8_t value2  = CapSense_CheckIsSensorActive(CapSense_PROXIMITYSENSOR1__PROX);
            /* Process output if proximity sensor was active */

             LED_Write(~value1);         
            /* Trigger the next Scan of proximity sensor */
            CapSense_ScanSensor(CapSense_PROXIMITYSENSOR0__PROX);

        }
        

    }
}

/* [] END OF FILE */

Credits

Ashok R

Ashok R

15 projects • 42 followers
Hobbyist/Engineer/Director/Animatior

Comments