# How to asynchronously (non-blocking) schedule a function to execute after a specific delay?

**URL:** <https://forum.makecode.com/t/how-to-asynchronously-non-blocking-schedule-a-function-to-execute-after-a-specific-delay/32673>\
**Category:** micro:bit\
**Created:** [December 23, 2024, 3:49pm UTC](https://forum.makecode.com/t/how-to-asynchronously-non-blocking-schedule-a-function-to-execute-after-a-specific-delay/32673 "2024-12-23T15:49:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![muz](https://avatars.discourse-cdn.com/v4/letter/m/bc8723/32.png) [@muz](https://forum.makecode.com/u/muz)\
**Post date:** [December 23, 2024, 3:49pm UTC](https://forum.makecode.com/t/how-to-asynchronously-non-blocking-schedule-a-function-to-execute-after-a-specific-delay/32673/1 "2024-12-23T15:49:35Z")

</div>

How to asynchronously (non-blocking) schedule a function to execute after a specific delay? Foe example, how to realize the functionality described in the following pseudo-code?

> input.onButtonPressed(Button.A, function () {
> 
> ```
> do_this_async(function(){
> basic.pause(3000)
> basic.showIcon(IconNames.Happy)
> })
> 
> basic.showIcon(IconNames.Triangle)
> 
> ```
> 
> })

---

<div class="post-metadata">

**Author:** ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)\
**Post date:** [December 23, 2024, 3:51pm UTC](https://forum.makecode.com/t/how-to-asynchronously-non-blocking-schedule-a-function-to-execute-after-a-specific-delay/32673/2 "2024-12-23T15:51:26Z")

</div>

I made a port of the `arcade-timers` extension for micro:bit.

> **[GitHub - robo-technical-group/pxt-microbit-timers: Port of pxt-arcade-timers to the micro:bit...](https://github.com/robo-technical-group/pxt-microbit-timers)**
>
> Port of pxt-arcade-timers to the micro:bit platform

You can learn about the extension here:

> **[Timers](https://arcade.makecode.com/pkg/microsoft/arcade-timers)**
>
> Timers and executation control.
