Running Time

Find how long a program has run since it was started, in milliseconds.

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 Calliope mini, 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, running time micros