How to Set and Catch Interrupts
摘要
All the various iterations of the flashing LEDs program had one thing in common; they were one large loop using different methods to control the timing of the flashing. If this was part of a larger program that did other tasks, such as driving a robot, then putting in hooks everywhere to check if the LEDs need processing is annoying and can easily lead to bugs.