Skip to content

Commit

Permalink
add wdt.py
Browse files Browse the repository at this point in the history
  • Loading branch information
junhuanchen committed Mar 14, 2019
1 parent 06b087f commit ab4e912
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions 12.network/server_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@

# in your code

while True:
cl, addr = server.accept()
print('client connected from', addr)

buf = cl.recv()

if b'open' in buf:
print(b'open')

cl.send(buf)
cl.close()
finally:
# it will throw error OSError: [Errno 12] ENOMEM if your dont exec the code.
server.close()
8 changes: 8 additions & 0 deletions 13.system/watchdog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

import machine

t = machine.WDT(0, 5) # init wdt 0, timeout 5s

t.feed() # feed it

t.delete() # close it

0 comments on commit ab4e912

Please sign in to comment.