adding stop-watch project (#1207)

This commit is contained in:
Peli de Halleux
2018-09-11 09:03:06 -07:00
committed by GitHub
parent e27232667d
commit 3a9de3545e
5 changed files with 59 additions and 25 deletions

View File

@ -1,20 +0,0 @@
# Stop watch
Press ``A`` to start the counter. Press ``A`` again to stop and display the duration.
```blocks
let sec = 0
let start = 0
input.onButtonPressed(Button.A, function () {
if (!(start)) {
start = input.runningTime()
basic.showIcon(IconNames.Butterfly)
} else {
sec = input.runningTime() - start / 1000
start = 0
basic.clearScreen()
basic.showNumber(sec)
}
})
start = 0
```