Giant FrankenGecko!
One of the two projects underway is the beating LED heart.
After showing the LED heart prototype to my client they were most impressed and wanted more inprovements.
His original idea was just to have the LEDs in a binary state either on or off.
This meant that the heart could only flash and not look like it is beating.
To make it look a little more realistic, I suggested that we could vary the brightness of the LEDs to get a better result.
For testing this concept out I needed;
A way to vary the brightness of the LEDS
A way to control the brightness
By today's standards controlling LED intensity LED brightness can be controlled using PWM (Pulse Width Modulation).
The Giant Gecko has inbult timers specifically for this capability.
Rather than reinventing the wheel, I looked though the EFM32 Lizard Lounge to find an example and sure enough there was one.
I found one at http://forum.energymicro.com/best-content
The code is not complete but it had enough to get the point across.
I built a blank template project and workspace and inserted the code verbatim and then added the required #include statements and other required items to get the code working properly.
As you can see from the video, it blinks rather slowly. The only reason for this is the frequency of the PWM source clock - a one second period.
To get the appearance of variable brightness the frequency must be increased for visual persistence to work.
I needed a way to vary the duty cycle of the PWM and since the STK3700 has an inbuilt capacitive sensor I decided to use it for this purpose.
To accomplish what I wanted I took the STK3700 CapSENSE example code and add the PWM code elements to it.
The LED lit by touching the capactive slider and its intensity is controlled by the postion touched on the slider.
The dimming effect looks much better in real life.