aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/examples/button
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2018-09-15 01:08:31 +0200
committerAyke van Laethem <[email protected]>2018-09-15 01:58:54 +0200
commit2a20c0c7f0c13c9b5c81422ea1c24ddd4eb765e7 (patch)
tree1375b629a1b845f9bd1f9f85bfe553e8e0b76d95 /src/examples/button
parent1ac67cf8de41a74bb3998915b407856aa346511e (diff)
downloadtinygo-2a20c0c7f0c13c9b5c81422ea1c24ddd4eb765e7.tar.gz
tinygo-2a20c0c7f0c13c9b5c81422ea1c24ddd4eb765e7.zip
all: rewrite sleep function
time.Sleep now compiles on all systems, so lets use that. Additionally, do a few improvements in time unit handling for the scheduler. This should lead to somewhat longer sleep durations without wrapping (on some platforms). Some examples got smaller, some got bigger. In particular, code using the scheduler got bigger and the blinky1 example got smaller (especially on Arduino: 380 -> 314 bytes).
Diffstat (limited to 'src/examples/button')
-rw-r--r--src/examples/button/button.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/examples/button/button.go b/src/examples/button/button.go
index 3be226c4d..30261b8c9 100644
--- a/src/examples/button/button.go
+++ b/src/examples/button/button.go
@@ -2,7 +2,7 @@ package main
import (
"machine"
- "runtime"
+ "time"
)
// This example assumes that the button is connected to pin 8. Change the value
@@ -23,6 +23,6 @@ func main() {
led.High()
}
- runtime.Sleep(runtime.Millisecond * 10)
+ time.Sleep(time.Millisecond * 10)
}
}