Monday, 30 January 2012

Playing with LEDs

I decided to take a break from the work on my wireless sensor network to play around with some components from my ARDX starter kit which I hadn't used yet.

This was all pretty straightforward. I used the following tutorials.
The circuit I ended up with looked like this.


From the left, this has a dimmer switch, two regular LEDs, a light sensor, a push button and on the far right is an RGB LED which oomlout includes for free with orders.

In the end I disabled the regular LEDs and the light sensor and just controlled the RGB LED. In my first configuration I used the button to cycle between the R/G/B LED and the potentiometer to change the brightness of the selected color. This was nice but fiddly so I changed the code to only use the button to start/stop a programmed sequence of colors. The colors are generated by ramping the R/G/B LEDs from 0 up to 255 and back down to 0 again. Each color uses a different increment so that the overall color shifts smoothly through all of the colors which are possible.

The results turn out to be very hard to film because my iPhone does a good job of adjusting the color balance to cancel out the changing LED. However, here are a couple of attempts.

 


As ever, my source code is available here.

No comments:

Post a Comment