This code example uses two PWMs and an XOR gate to make an LED gradually cycle through increasing and decreasing brightness. There is no CPU usage beyond PWM initialization.
The hardware design features two PWM Components. They have slightly different periods, with 50% duty cycles. Routing them through an exclusive-OR (XOR) gate yields an output signal with a gradually changing duty cycle. Driving an LED with this signal results in a “breathing” effect, where the LED gradually gets brighter and dimmer. The rate of change is proportional to the difference between the PWM output frequencies.
For more information on the code example, go to:
http://www.cypress.com/documentation/code-examples/ce203303-psoc-3-and-psoc-5lp-breathing-led
Comments