Arduino


Arduino
Originally uploaded by bluesterror.

I’ve had a few parts setting around a while for an upcoming electronics project, but it hasn’t gotten far off the ground because I was too lazy to spec out the control circuitry. I wanted it to be microcontroller based, but realizing that serial and parallel ports are ever-dwindling, I also wanted to make sure that I purchased/built a programmer that would still work in a few years’ time. Enter the Arduino, a perfect little development board based around the Atmel ATmega8; at only $30 for the board and chip, it’s a great deal. The chip comes pre-programmed with a bootloader that you can use over USB to upload your programs.

Programming the microcontroller is a snap. The Linux toolchain features a port of gcc and a small libc. There’s also watered down dialect of C and an IDE that noobs can use, but I just skipped to building with the arduino libraries and avr-gcc directly. Within 15 minutes of installing the necessary packages, I had my first program uploaded and blinking an LED. Pictured above is the second try, a simple RGB pixel consisting of 3 LEDs which fade among themselves (the effect is less than perfect without a good diffuser and smaller LEDs).

Here’s the code for the fade:

#include <WProgram.h>

int rpin = 9;
int gpin = 10;
int bpin = 11;

static int cols[3], i;

void setup()
{
pinMode(rpin, OUTPUT);
pinMode(gpin, OUTPUT);
pinMode(bpin, OUTPUT);
cols[0] = 255;
cols[1] = 0;
cols[2] = 0;
}

void next_color()
{
int before = i-1;

if (before < 0)
before = 2;

if (cols[i] < 255)
cols[i]++;
else if (cols[before] > 0)
cols[before]--;
else
i = (i+1) % 3;
}

void loop()
{
next_color();
analogWrite(rpin, cols[0]);
analogWrite(gpin, cols[1]);
analogWrite(bpin, cols[2]);
delay(10);
}

Aquarium

While back in Atlanta two weeks ago, Angeline and I toured the one year old Georgia Aquarium, billed as the World’s Largest, perfect for a land-locked city, I hunted around the net the night before for some audio podcasts and found a couple, but the free ones that are on the official aquarium website are definitely the best. We followed the audio tour, looked around at the many fish, got hungry, then ate burgers at the Vortex, and I brought back lousy pictures. Click below for the goods.

Papers, please

I applied for a passport for the first time in mid-October of this year. I was sure that I had waited too long, that I would get one of these damnable passports with the RFID chips in them, and that my next purchase was sure to be an RFID zapper. But it arrived last week, and to my surprise, it lacked the magic you’ve-been-screwed symbol. It’s still not too late to get a non-chipped one! I believe it’s basically luck of the draw at this point, but for what it’s worth, I bought mine at the post office and got the non-expedited variety.

Whew, 10 years until I have to get tagged. I’ll wait in the long line as long as they will let me, thank you very much.

What’s wrong with RFID passports?
How can I tell if my passport has an RFID chip?

Don’t panic


Don’t panic
Originally uploaded by bluesterror.

Ever since buying my Accord a couple of years ago, I’ve been an enthusiastic frequent user of the keyless entry, as well as an unenthusiastic occasional user of its far-too-easily-activated panic mode. Whenever I sit on my keys, press on the pocket where my key fob resides, or hold it just so (usually when I’m carrying in groceries at 11pm on my quiet residential street), my car’s horn starts blaring, lights flash, and I have to run to my car hitting the unlock button until it shuts up. Yesterday, I triggered it twice, so I finally decided to do something about it. So I did some surgery: I took a box knife to the traces on its PCB and after thirty minutes (made longer because I screwed up and had to fix a mistake) I now have a fully un-functioning panic button on this thing.

I hope I never need it.

Gauged Encounter

I think I voted today.

Ange and I fulfilled our pre-Cana responsibilities in one fell swoop last week
by attending a weekend retreat. As in, you must retreat from your senses to
endure the silliness of the whole affair. The weekend was set up as a nonstop
series of lectures by a parade of snippy, passive-aggressive Catholic couples
(examples for us all), followed by sessions in which we betrothed would answer
discussion questions and then privately compare notes on the matter. The first
two or three were actually pretty good, touching on our past together, how we
planned to handle various aspects of married life and our plans for the future.
I’m happy to say Ange & I know each other well enough that we generally wrote the same things to each other. Then it got repetitive, and at turns disturbing, at which point we began writing essays with the sole aim of making the other laugh.

Here are some excerpts:

Q. How will our differences complement each other?


A. It helps that you are a genetic male XY and I am a genetic female XX.

On theology:


Open our hearts to God => God is a heart surgeon => God has God complex

On sexuality in marriage, after the 60-year-old couple described their lovemaking-eww-eww-eww-ness:


Tips for keeping the flame alive:

  • Movie fantasy
  • "Special" foot rubs
  • Hide X-rated greeting cards around the house
  • Conflate sex with religion
  • Dungeon

On our future family:


Reasons for having children:

  • Organ source
  • DNA propagation
  • Christmas gifts
  • Kid's menus
  • Geriatric caregivers

And then there were lots of snarky comments about Natural Family Planning, too. Despite our lack of reverence we graduated anyway, and all in all it wasn’t too bad, but I am so glad that’s over with.

Blaze

Dear people who pulled the fire alarm at Angeline’s apartment the other evening, causing the fire department to arrive, sirens a-blaring,

Please wait for warmer, non-rainy weather next time.

Thanks.

I dislike Java.

Dear lazy web,

It would be nice if you could tell me a non-hacky way to do progress dialogs from within the event-dispatch thread in Swing, where all of our application logic happens to reside.

This doesn’t work:
display modal dialog
start worker thread
(won’t run because event thread is blocked)

Nor does this:
start worker thread
display modal dialog
(race condition hiding the dialog)

Joining in the event thread won’t work because it blocks updates. Using a non-modal dialog and passing the bottom-half of the rest of the event thread to the worker thread to execute at completion will work, but is obscenely messy. Or, one can spin in the beginning of the thread waiting for the modal dialog to appear to avoid the race condition, but that is still gross. One could subclass Dialog and have it also signal a condition variable once it blocks… ugh.

Fusion

As the ticket says, last night we went to the State to catch Al Di Meola, who is touring in support of his new CD Consequences of Chaos. Amazing show replete with Di Meola’s signature blazing-fast yet incredibly clean lines. The Project led off with a few selections from the new CD, then went into Azzura, Fugata, and from there into a rousing rendition of the Santana-like single from the new CD, “Red Moon.” The band took a break and came back with Al playing a few Piazzolla pieces solo on his nylon string guitar, the last teaming up with pianist Mario Parmisano who unfortunately loaded up the bandoneon patch on his keyboard (can’t we pretend those instruments never existed?). After that, Al picked up the PRS again, launched into “Turquoise” off of the new album, then the Chick Corea tune “Senor Mouse.” I can’t remember what finished up the set, but the encores were ambitious: “Race With the Devil” followed by “Egyptian Danza.” The only flaws in the performance lie at the feet of the sound engineers who had problems with feedback in the middle of the show, poor mixes, and a speaker that was picking up a radio station as if it was right out of Spinal Tap.

Denied

I just finished reading Woodward’s new book, State of Denial, a very provocative and damning look at the Bush administration’s handling of the war in Iraq. My take-aways are: Rumsfeld is a jerk, a bunch of PhDs can bollocks things up quite nicely merely by lying, and Colin Powell is an AOLer. Worth a read.

No idea what to be for Halloween this year. I suppose that is okay since I don’t have any plans either. Perhaps I should make another rock-icon-o-lantern?

LX

I’ve been sick the last few days. Meh.

I went down to Georgia last weekend, looking for a soul to steal, as usual. My grandparents have attained their sixtieth year of marriage this year, so I spent 20 hours in the Atlanta suburb in which I once resided.

The lady at the check-in counter told me to have a nice flight, and I said “you too.” I used to enjoy flying, but the soviet checkpoints we must navigate now have really killed it for me. Wearing my EFF shirt, I was surprised to not get the magic SSSes on my boarding pass. The trek through the screening area still sucked, though, even without the special treatment. I expect that for Thanksgiving I’ll be driving my car instead. Thanks, 4th amendment haters.

My grandparents are doing well. My grandfather congratulated me on the engagement news and wished us our own 60 years of bliss. We grandchildren presented them with a scrapbook of various detritus of our lives and toasted their health. Teary tributes were made, and so on. It was a nice visit, if too brief.