Is there a way to set a one time timer interrupt on the Raspberry Pi Pico? I.e. in code, I would be able to tell the hardware timer to interrupt me in a specified period of time. Example pseudocode would look something like this:

interrupt_me_in(10ms, &isr);  // relatively high precision required (edited - said 1000ms before)

The idea is that the program would receive an interrupt which is serviced by isr 1 second after the line interrupt_me_in(1000ms, &callback) was executed.

Every resource online seems to only deal with regular interrupts (e.g. timer interrupt every 1 second), not one-time interrupts.

I'm not using timer interrupts for anything else, so I wouldn't mind hijacking functionality from the regular timer interrupts to achieve this goal. However, I would rather avoid having a regular timer interrupt going off very frequently with a routine checking whether it should set off my one-time interrupt above.

2 Answers 2


If there are only regular timer interrupts you will need to cancel the regular timer after the interrupt.


For those who see the in the future: I found a solution. The add_repeating_timer_ms and add_repeating_timer_us functions take callbacks which return a boolean value: if that bool is false, they stop the regularly firing timer. So you can set a repeating timer and cancel it after the first interrupt by returning false from the interrupt handler.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.