Skip to content

Commit 7ec83bb

Browse files
committed
Harmonized code examples
1 parent 31659c3 commit 7ec83bb

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

README.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,17 +334,19 @@ After wiring it all together (as shown above), the code to let the LED blink wil
334334
import time
335335
import machine
336336

337+
SLEEP = 1.0
338+
337339
# Pin D1 is mapped to GPIO 5
338340
ledPin = machine.Pin(5, machine.Pin.OUT)
339341

340342
while True:
341343
ledPin.on()
342344
print("LED is on")
343-
time.sleep(2.0)
345+
time.sleep(SLEEP)
344346

345347
ledPin.off()
346348
print("LED is off")
347-
time.sleep(2.0
349+
time.sleep(SLEEP)
348350
```
349351

350352
Once again, this results an a very predictable output (next to the LED behaving like a christmas tree): :christmas_tree:

examples/led/main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
import machine
44

5+
SLEEP = 1.0
6+
57
# Pin D1 is mapped to GPIO 5
68
ledPin = machine.Pin(5, machine.Pin.OUT)
79

810
while True:
911
ledPin.on()
1012
print("LED is on")
11-
time.sleep(2.0)
13+
time.sleep(SLEEP)
1214

1315
ledPin.off()
1416
print("LED is off")
15-
time.sleep(2.0)
17+
time.sleep(SLEEP)

0 commit comments

Comments
 (0)