From 7ec83bb5ed851d0c58164eb09ce5eb1dea44319a Mon Sep 17 00:00:00 2001 From: Philipp Montesano Date: Fri, 4 Oct 2019 15:34:41 +0200 Subject: [PATCH] Harmonized code examples --- README.adoc | 6 ++++-- examples/led/main.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.adoc b/README.adoc index 92a0a20..a25ae3e 100644 --- a/README.adoc +++ b/README.adoc @@ -334,17 +334,19 @@ After wiring it all together (as shown above), the code to let the LED blink wil import time import machine +SLEEP = 1.0 + # Pin D1 is mapped to GPIO 5 ledPin = machine.Pin(5, machine.Pin.OUT) while True: ledPin.on() print("LED is on") - time.sleep(2.0) + time.sleep(SLEEP) ledPin.off() print("LED is off") - time.sleep(2.0 + time.sleep(SLEEP) ``` Once again, this results an a very predictable output (next to the LED behaving like a christmas tree): :christmas_tree: diff --git a/examples/led/main.py b/examples/led/main.py index 270b7d8..ef86aac 100644 --- a/examples/led/main.py +++ b/examples/led/main.py @@ -2,14 +2,16 @@ import machine +SLEEP = 1.0 + # Pin D1 is mapped to GPIO 5 ledPin = machine.Pin(5, machine.Pin.OUT) while True: ledPin.on() print("LED is on") - time.sleep(2.0) + time.sleep(SLEEP) ledPin.off() print("LED is off") - time.sleep(2.0) + time.sleep(SLEEP)