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 was doing 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. Another approach is to set a timer interrupt; here, we program a timer, which, when it goes off, interrupts our program to process ...
11. How to Set and Catch Interrupts
Get RP2040 Assembly Language Programming: ARM Cortex-M0+ on the Raspberry Pi Pico now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.