How Geeks Celebrate the Holidays!

I tend to like reading MAKE’s blog often to get ideas for future projects and came across a blog post recently about using your electronic skills to help celebrate the Holiday season.

I’m thinking of trying my hand at programming one of the character LEDs and building a menorah from scratch. From what I can tell about the project, the following psudocode is a good guess at how the programs work:

void main()
{
   power_up_initialization(); //configure the chip's I/O, registers, etc

   which_to_run = read_flash_value(); //get current program to run

   if (which_to_run >= max_number_of_programs)
   {
      which_to_run = 0; // start from beginning
   }

   write_flash_value(which_to_run + 1); //setup the next program to run

   //run forever
   while()
   {
      //pick which program configuration to run
      switch (which_to_run)
      {
         case (0):
            program_0();
            break;
         ...
         case (N):
         default:
            demo();
            break;
      }
      delay();
   }
}

Tags:

 
 
 

Comments are closed.