pxt-calliope/docs/reference/input/running-time.md
Sam El-Husseini e3975e65e5 pxt-microbit Accessibility PR (#529)
* Accessibility changes
2017-09-07 13:42:08 -07:00

626 B

Running Time

Find how long it has been since the program started.

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.onButtonPressed(Button.B, () => {
    let now = input.runningTime()
    basic.showNumber(now)
})

See also

show number, pause