Fun Friday: OCCC, Arduino style...

Alright everyone - something that popped into my head after seeing Andrew's lovely use of the ternary operator:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1285805049/3#3

How about this: the Arduino Obfuscated C Code Contest!

Just how ugly can you make the Blink example? Rules are:

  1. The task performed should be simple
  2. Standard Arduino only (ATMega8/168/328)
  3. Nothing extra than basic parts allowed (no really complex circuits - if you want to interface a button, an LED, a servo, a small speaker - cool; anything beyond that is off-limits)
  4. Must fit within the memory limits of an ATMega8 (so that even really old Arduino boards can run it)
  5. No rehashes of old IOCCC entries allowed (this is an "on-your-honor" rule) - come up with something new!
  6. Code must be self-contained - no reliance on an external PC program sending data via serial allowed (you should be able to disconnect the Arduino from the PC after programming and it should still run - of course, if the Arduino is sending data to the PC - that is OK)
  7. You have until next Friday to submit entries (post 'em here - as code or a link to the sketch, if you want)
  8. Judging to be done by the forum members
  9. Prizes? What prizes?

This is just a "for fun" thing. As the originator of this contest, I will gracefully bow out of participating (actually, I think I would stink at participation, anyhow - I've never actually tried such a contest before, and I've been steeped in such "good coding and documentation" techniques and such that going back to my old-self when I was 10 years old coding in Microsoft ROM BASIC would be nearly impossible)...

;D

Above all - have fun!

:sunglasses:

OK, here is mine. Doesn't work on a mega8 but fine on standard 328.

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 */

void setup() {                
  DDRB = B00100000;  
}
void loop() {
  PINB = B00100000;
  delay(1000);              // wait for a second  
}

I will post something interesting after the deadline, be sure to check it out ;D