Skip to content

Commit b883820

Browse files
committed
esp8266/examples: Fixed code formatting.
1 parent 8f8abcc commit b883820

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

ports/esp8266/examples/softuart_read.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,21 @@
66

77
poll = select.poll()
88

9-
s1 = SoftUART(Pin(2), Pin(4), baudrate=9600, timeout=0) # tx=2 rx=4
10-
s2 = SoftUART(Pin(0), Pin(5), baudrate=9600, timeout=0) # tx=0 rx=5
9+
s1 = SoftUART(Pin(2), Pin(4), baudrate=9600, timeout=0) # tx=2 rx=4
10+
s2 = SoftUART(Pin(0), Pin(5), baudrate=9600, timeout=0) # tx=0 rx=5
1111
poll.register(s1)
1212
poll.register(s2)
1313

1414
print("polling...")
1515

1616
while True:
17-
read = poll.ipoll()
17+
read = poll.ipoll()
1818

19-
for r, ev in read:
20-
if (ev & select.POLLIN) != 0:
21-
i=None
22-
if r is s1: i="s1"
23-
else: i="s2"
24-
print(i, r.read())
19+
for r, ev in read:
20+
if (ev & select.POLLIN) != 0:
21+
i = None
22+
if r is s1:
23+
i = "s1"
24+
else:
25+
i = "s2"
26+
print(i, r.read())

ports/esp8266/examples/softuart_write.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
from machine import SoftUART, Pin
44
import time
55

6-
s1 = SoftUART(Pin(2), Pin(4), baudrate=9600, timeout=0) # tx=2 rx=4
7-
s2 = SoftUART(Pin(0), Pin(5), baudrate=9600, timeout=0) # tx=0 rx=5
6+
s1 = SoftUART(Pin(2), Pin(4), baudrate=9600, timeout=0) # tx=2 rx=4
7+
s2 = SoftUART(Pin(0), Pin(5), baudrate=9600, timeout=0) # tx=0 rx=5
88

99
while True:
10-
print("sending... ",end="")
11-
s1.write("Hello world s1\r\n")
12-
print("1, ", end="")
13-
s2.write("Hello world s2\r\n")
14-
print("2, done.")
15-
time.sleep(1)
10+
print("sending... ", end="")
11+
s1.write("Hello world s1\r\n")
12+
print("1, ", end="")
13+
s2.write("Hello world s2\r\n")
14+
print("2, done.")
15+
time.sleep(1)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy