1 Reply Latest reply on Apr 18, 2018 2:16 AM by ShanmathiN_06

    Control analog output with capsense slider

      Hey guys.

      I'm fairly new to PSoC development. Just got a CY8CKIT-050 5LP Development Kit recently. I've been trying to control the brightness of an LED using the Capsense slider. I used the "CapSense CSD Design" code example to get started, and made some changes to include an output pin at P3[7] (connected to an external LED) , and a VDAC to convert the capsense position value to analog for the pin. I got the LED to turn on/off using the capsense buttons without using the VDAC. I was wondering if anyone could guide me on controlling the brightness of the led with the slider.


      I've added some screenshots of my project.


      Thank you.

        • 1. Re: Control analog output with capsense slider



          The brightness of LED could be controlled with slider, using a PWM instead of VDAC.

          The output of VDAC is not buffered. So, it is not recommended to use VDAC for driving LEDs.


          PWM's duty cycle is to be varied according to the current slider position.

          Use API PWM_WriteCompare(uint8/16 compare) in run time to modify the duty cycle accordingly, when the slider position changes.