epl70

boot.py with Wifi-Login

Sep 17th, 2022
1,537
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | Source Code | 0 0
  1. # This file is executed on every boot (including wake-boot from deepsleep)
  2.  
  3. def do_connect(ssid, pwd):
  4.     import network
  5.     sta_if = network.WLAN(network.STA_IF)
  6.     if not sta_if.isconnected():
  7.         print('connecting to network...')
  8.         sta_if.active(True)
  9.         sta_if.connect(ssid, pwd)
  10.         while not sta_if.isconnected():
  11.             pass
  12.     print('network config:', sta_if.ifconfig())
  13.  
  14. # This file is executed on every boot (including wake-boot from deepsleep)
  15. #import esp
  16. #esp.osdebug(None)
  17.  
  18. # Attempt to connect to WiFi network
  19. do_connect('SSID', 'your-wlan-password')
  20.  
  21. import webrepl
  22. webrepl.start()
  23.  
Tags: micropython
Advertisement
Add Comment
Please, Sign In to add comment