So actually, the event that catalyzed the starting of this blog was that I've started tinkering with an Arduino. I received an Arduino last week, and then the other day I went to RadioShack to pick up a couple components: some resistors, LEDs, switches, wire, a photosensor, a crummy little speaker, and a pot, so nothing fancy.
Today, I began messing around with my new toy. I've connected a 10kΩ potentiometer to the analog input, and a red LED (with a small resistor) to the digital output. The code is incredibly simple: it reads the value of the potentiometer, on a scale of 0 to 1023, and maps that to a more usable scale of 0 to 20. (Let's call that mapped value "x.") Then there's a simple pulse-width modulation, where the LED is turned on for x milliseconds, and then turned off for 20-x milliseconds. That way, the illusion of dimming is created, so that the LED's brightness appears to vary as the potentiometer is turned.
 |
The LED lit brightly... |
 |
...and more dimly. |
Unfortunately, my potentiometer kind of sucks, since I was buying on a budget. The bottom 10% or so reads to 0, which is unfortunate, because that means the LED turns off way too fast at the end. C'est la vie - all the parts are in place, and I've learned a little about interfacing with an Arduino, which is pretty neat. Now I just need to figure out more things to make.