Using Interrupts

Also look at the Multi_Blink example in the Playground. You can adapt this to your purposes by putting calling appropriate functions to do what you need rather than just blinking LEDs.