Monday, January 19, 2009

Beyonce's "If I were a boy" in Morse code on an Illuminato

What can I say? It's been a pretty long weekend :) Mike and I were literally holed up in CT building Illuminato's by hand, and have a couple of pictures to prove it!




I have to admit, to keep things a little interesting while soldering all those little LED's together, I had my itunes playlist running in the background with a few new songs from the pop list. Normally, I wouldn't admit that kind of thing in public, but I suppose the solder fumes are getting to my head.

So since I now know all the lyrics after about 70 times on repeat, I figured it was only fitting to make a nerdy tribute to Beyonce's "If I were a boy" song ... so here's a little program that flashes the lyrics of the song in Morse Code in sync with the real song, and it does so by blinking the white LED's on the backside of the Illuminato, called with the bling(ON) and bling(OFF) commands. I've included the source code, which of course contains a complete morse ASCII-to-morse encoder.



And yes, at the end of the app, I appended a few extra letters... just for fun. :-) I also uploaded all my code to the app store here. This app has zero practical purpose, except maybe if it had a Lithium Backpack on the other side, you could carry it in your pocket, in case you need to communicate with a U-boat or signal mayday or signal for help from the Titanic and the date is 1920 and they can somehow decode +60 Morse code words per minute, visually not auditorily, and they're not weirded out by the fact that you're saying "If I were a boy, I think I could understand how it feels to love a girl I swear I'd be a better man." I think that rules out everyone. And even if they did, they'd probably leave you alone anyway.

Here's a snapshot of the morse code decoder code:


void morse( char m) {
switch (m) {
case 'A': case 'a':
dit();dash();
break;
case 'B': case 'b':
dash();dit();dit();dit();
break;
case 'C': case 'c':
dash();dit();dash();dit();
break;
case 'D': case 'd':
dash();dit();dit();
break;
case 'E': case 'e':
dit();
break;
case 'F': case 'f':
dit();dit();dash();dit();
break;
case 'G': case 'g':
dash();dash();dit();
break;
case 'H': case 'h':
dit();dit();dit();dit();
break;
case 'I': case 'i':
dit();dit();
break;
case 'J': case 'j':
dit();dash();dash();dash();
break;
case 'K': case 'k':
dash();dit();dash();
break;
case 'L': case 'l':
dit();dash();dit();dit();
break;
case 'M': case 'm':
dash();dash();
break;
case 'N': case 'n':
dash();dit();
break;
case 'O': case 'o':
dash();dash();dash();
break;
case 'P': case 'p':
dit();dash();dash();dit();
break;
case 'Q': case 'q':
dash();dash();dit();dash();
break;
case 'R': case 'r':
dit();dash();dit();
break;
case 'S': case 's':
dit();dit();dit();
break;
case 'T': case 't':
dash();
break;
case 'U': case 'u':
dit();dit();dash();
break;
case 'V': case 'v':
dit();dit();dit();dash();
break;
case 'W': case 'w':
dit();dash();dash();
break;
case 'X': case 'x':
dash();dit();dit();dash();
break;
case 'Y': case 'y':
dash();dit();dash();dash();
break;
case 'Z': case 'z':
dash();dash();dit();dit();
break;
case '1':
dit();dash();dash();dash();dash();
break;
case '2':
dit();dit();dash();dash();dash();
break;
case '3':
dit();dit();dit();dash();dash();
break;
case '4':
dit();dit();dit();dit();dash();
break;
case '5':
dit();dit();dit();dit();dit();
break;
case '6':
dash();dit();dit();dit();dit();
break;
case '7':
dash();dash();dit();dit();dit();
break;
case '8':
dash();dash();dash();dit();dit();
break;
case '9':
dash();dash();dash();dash();dit();
break;
case '0':
dash();dash();dash();dash();dash();
break;
case '/':
dash();dit();dit();dash();dit();
break;
case '+':
dit();dash();dit();dash();dit();
break;
case '=':
dash();dit();dit();dash();dit();
break;
case '.':
dit();dash();dit();dash();dit();dash();
break;
case ',':
dash();dash();dit();dit();dash();dash();
break;
case '?':
dit();dit();dash();dash();dit();dit();
break;
case '(':
dash();dit();dash();dash();dit();
break;
case ')':
dash();dit();dash();dash();dit();dash();
break;
case '-':
dash();dit();dit();dit();dit();dash();
break;
case '"':
dit();dash();dit();dit();dash();dit();
break;
case '\_':
dit();dit();dash();dash();dit();dash();
break;
case '\'':
dit();dash();dash();dash();dash();dit();
break;
case ':':
dash();dash();dash();dit();dit();dit();
break;
case ';':
dash();dit();dash();dit();dash();dit();
break;
case '$':
dit();dit();dit();dash();dit();dit();dash();
break;
case ' ':
waitalittle();
break;
default:
break;
}
}


void dit( void) {
bling(ON);
delay(DITDELAY);
bling(OFF);
delay(AFTERCHARDELAY);
}

void dash( void) {
bling(ON);
delay(DASHDELAY);
bling(OFF);
delay(AFTERCHARDELAY);
}

void waitalittle( void) {
delay(SPACEDELAY);
}

2 comments:

Matt said...

yep, part 2 is up: http://www.youtube.com/watch?v=_QU43poSFBY

geez, lots of making fun to be had... and yes, get ready for my upcoming career in morse-code synced techno music!

Nathan Gerald Gagne said...

Thanks guys, one of those is mine : )
Ill be looking forward to tinkering with it soon.