pxt-calliope/docs/reference/input/running-time.md
Juri Wolf 5f7a8e5301
Updates for V4 (#197)
* update yotta defaults for 16kb devices

* refactor deprecated blocks

* updates for button events

* update button events

* update refference

* update docs

* update docs

* update button event blocks

* update docs

* update block id
2022-08-10 09:36:19 -07:00

667 B

Running Time

Find how long it has been since the program started in milli-seconds.

input.runningTime();

Returns

  • the Number of milliseconds since the program started. (One second is 1000 milliseconds.)

Example: elapsed time

When you press button B on the microbit, this program finds the number of milliseconds since the program started and shows it on the LED screen.

input.onButtonEvent(Button.B, input.buttonEventClick(), () => {
    let now = input.runningTime()
    basic.showNumber(now)
})

See also

show number, pause