20 Apr 2007 jkkroll   » (Master)

Spoka - Episode IV - A New Hope

OK, so there’s nothing here about hope. I just couldn’t resist the Star Wars reference.

I did however succeed in implementing PWM on the RGB LEDs last night, so I now have 24 bit color for each eye. It turned out to just be a simple interrupt routine. Of course this solution is brute force, and takes up a *!@$load of the processors time (it interrupts every 256 clock cycles). Oh, well. I’ll worry about optimizing it later if I need to. Here’s the interrupt routine if anyone is interested.

if(pwmCounter>rred) LEDPORT|=R_RED;
if(pwmCounter>rgreen) LEDPORT|=R_GREEN;
if(pwmCounter>rblue) LEDPORT|=R_BLUE;
if(pwmCounter>lred) LEDPORT|=L_RED;
if(pwmCounter>lgreen) LEDPORT|=L_GREEN;
if(pwmCounter>lblue) LEDPORT|=L_BLUE;
pwmCounter=1; //reset counter

After a tiny bit of playing around with the color scales, I ended up implementing the first one in the list in the previous post, simply because I could do it programmatically, rather than as a large lookup table. I’m not really happy with the map though. I’d bet the linear optimized map or rainbow looks better (check them out with this java applet). Here’s my colormap function:

void scale1(unsigned char value){
if(value SetRGB((255-(2*value)),2*value,0);

I also ordered a Mirf with a tiny ceramic chip antenna so that it would fit inside the light. Hopefully iy will be here before the weekend, since I’m taking a 4/5 day weekend to work on the project.

Syndicated 2007-02-14 06:04:43 from robotguy.net/Blog

Latest blog entries     Older blog entries

Share this page