pxt-ev3/docs/reference/control/timer/millis.md
2018-02-22 14:56:15 -08:00

680 B

millis

Get the amount of time counted by the timer in milliseconds.

The timer count begins from 0 when you program starts or is reset.

Returns

  • a number that is the amount of time elapsed, in milliseconds, since the timer was started or reset.

Example

Find out how many milliseconds go by between presses of the down button on the brick.

brick.buttonDown.onEvent(ButtonEvent.Pressed, function () {
    brick.showValue("DownButtonTime", control.timer1.millis(), 1)
    control.timer1.reset()
})

See also

seconds, reset