From 3f1602f2c0ad8373d3980166648f82289ba5e63f Mon Sep 17 00:00:00 2001 From: Ron Hale-Evans Date: Mon, 23 May 2016 12:45:14 -0700 Subject: [PATCH] Simpler language, more interesting example (running time was always 0). --- docs/reference/input/running-time.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/reference/input/running-time.md b/docs/reference/input/running-time.md index 282b7946..df0651b8 100644 --- a/docs/reference/input/running-time.md +++ b/docs/reference/input/running-time.md @@ -1,6 +1,6 @@ # Running Time -Get the number of milliseconds elapsed since the script began. 1,000 milliseconds = 1 second. +Find how long it has been since the program started. ```sig input.runningTime(); @@ -8,15 +8,20 @@ input.runningTime(); ### Returns -* [Number](/reference/types/number) +* the [Number](/reference/types/number) of milliseconds since the program started. +(One second is 1000 milliseconds.) ### Example: elapsed time -This code gets the elapsed time since the start of the program execution and displays it on the screen. +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](/device/screen). ```blocks -let now = input.runningTime() -basic.showNumber(now) +input.onButtonPressed(Button.B, () => { + let now = input.runningTime() + basic.showNumber(now) +}) ``` ### Lessons