/* ========================================
 *
 * 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>
#include <stdio.h>
int16 wartosc=0;
uint8 enabled=0;	
char bufor[8];
int main()
{
	CyGlobalIntEnable;
	LCD_Start();
	CapSense_Start();
	CapSense_EnableWidget(CapSense_PROXIMITYSENSOR0__PROX);
	CapSense_EnableSensor(CapSense_SENSOR_PROXIMITYSENSOR0_0__PROX);
	CapSense_InitializeSensorBaseline(CapSense_SENSOR_PROXIMITYSENSOR0_0__PROX);
	
	
    /* Place your initialization/startup code here (e.g. MyInst_Start()) */

    /* CyGlobalIntEnable; */ /* Uncomment this line to enable global interrupts. */
    for(;;)
    {
		CapSense_ScanEnabledWidgets();
		CapSense_ScanSensor(CapSense_SENSOR_PROXIMITYSENSOR0_0__PROX);
		
		wartosc=CapSense_ReadSensorRaw(CapSense_SENSOR_PROXIMITYSENSOR0_0__PROX);
		sprintf(bufor, "%d", wartosc);
		LCD_Position(0u,6u);
		LCD_PrintString(bufor);
		
		if (wartosc<14040) 
		{
			LED3_Write(0u);
			LED4_Write(0u);
		}
		if ((wartosc>=14040)&&(wartosc<16000))
		{
			LED3_Write(1u);
			LED4_Write(0u);
		}
		if (wartosc>16000)
		{
			LED3_Write(1u);
			LED4_Write(1u);
		}	
		CyDelay(20);
        /* Place your application code here. */
    }
}

/* [] END OF FILE */
