The Capacitive Sensor library example demonstrates how to use the Capacitive Sensor library in practice.
The example initializes the Capacitive Sensor library to constantly monitor the level of the analog input 7 (AIN7). Every time the pad connected to AIN7 is touched, the application will print out information on UART. Additionally, the capacitive slider is enabled. You must connect AIN1, AIN2, and AIN4 to appropriate pads of your self-designed capacitive slider to get it to print out its value. Note that due to anomaly 84 (ISOURCE not functional) SAADC implementation of Capacitive Sensor low-level library is used by deafault. To use COMP change in sdk_config.h USE_COMP value to 1.
To run this example, you will need some kind of capacitive pad and slider. These can be made, for example, of aluminum foil. However, to get accurate values from the slider, it should be made of a material that does not change its capacity easily and should be designed according to common rules of capacitive sensor design.
You can find the source code and the project file of the example in the following folder: <InstallFolder>\examples\peripheral\csense
Test the Capacitive Sensor library example application by performing the following steps:
If no information is printed out on UART or the values from the slider are meaningless, try changing the THRESHOLD_PAD_1, THRESHOLD_PAD_2, THRESHOLD_PAD_3, THRESHOLD_PAD_4 or THRESHOLD_BUTTON value in the main example file.
Remember that the slider needs a while to calibrate. The best way to do this is to gently slide through all pads on the slider.