HALLOWE’EN 2008

 
 

Inspired by both the old and new versions of the TV show “Battlestar Galactica”, and a project from Evil Mad Scientist Laboratories, we built a Cylon pumpkin.


“Your pumpkin is cool”, said the first trick-or-treater.  We gave him 35 chocolate bars.



The original project used some parts I didn’t happen to have on hand and wasn’t sure I could find quickly, but I did have an Arduino, and I found a local store selling extra-bright LEDs for $0.50  (Which incidentally  are way better than normal $0.15 LEDs.)  Plus, I’m a software guy, I wouldn’t know what to do with a 555 timer anyway.


For my fellow coders, below is the actual Arduino source code for the Cylon light flashing program.  The Arduino gives you an easy programming environment on the Mac and a tool to transmit the compiled code over USB to the device itself, which then runs on its own.  digitalWrite( pinNumber, HIGH ) is all it takes to turn on an LED connected to a particular output pin. This is fun.  (Here’s how to get started.)

 

/* Arduino cylon light cycling program - Hallowe’en 2008 */


/* Declare certain pins to be output pins. */

void setup()

{

  int i;

    int minPin = 4;

  int maxPin = 14;

  for ( i = minPin; i <= maxPin; i++ ) {

    pinMode(i, OUTPUT);

  }


}


/* Turn the lights on from pins 4 thru 14, 2 at a time,

  1. *and then turn them off. */

void loop()

{


  int onDelay = 60;

  int i;

 

  int minPin = 4;

  int maxPin = 14;

 

  int fudge = 2;

 


  /* cycle the LEDs up. from 4 to 14  Turn one on, pause a bit, and then turn another one off */

  for ( i = minPin; i < maxPin+fudge; i++ ) {

    digitalWrite( i, HIGH );

    delay(onDelay);

   

    digitalWrite( i-fudge, LOW );


  }


  /* And do it again in the other order. */

 

  for ( i = maxPin; i > minPin-fudge; i-- ) {

    digitalWrite( i, HIGH );

    delay(onDelay);

   

    digitalWrite( i+fudge, LOW );

   

  }

 

}