Skip to content

Commit ab4e912

Browse files
committed
add wdt.py
1 parent 06b087f commit ab4e912

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

12.network/server_base.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@
99

1010
# in your code
1111

12+
while True:
13+
cl, addr = server.accept()
14+
print('client connected from', addr)
15+
16+
buf = cl.recv()
17+
18+
if b'open' in buf:
19+
print(b'open')
20+
21+
cl.send(buf)
22+
cl.close()
1223
finally:
1324
# it will throw error OSError: [Errno 12] ENOMEM if your dont exec the code.
1425
server.close()

13.system/watchdog.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
import machine
3+
4+
t = machine.WDT(0, 5) # init wdt 0, timeout 5s
5+
6+
t.feed() # feed it
7+
8+
t.delete() # close it

0 commit comments

Comments
 (0)