boot.py 836 B

12345678910111213141516171819
  1. # This file is executed on every boot (including wake-boot from deepsleep)
  2. #import esp
  3. #esp.osdebug(None)
  4. #import webrepl
  5. #webrepl.start()
  6. import network
  7. wlan = network.WLAN(network.STA_IF) # create station interface
  8. wlan.active(True) # activate the interface
  9. wlan.scan() # scan for access points
  10. #wlan.isconnected() # check if the station is connected to an AP
  11. wlan.connect('WLAN+', 'XPmeg8i2U9') # connect to an AP
  12. #wlan.config('mac') # get the interface's MAC address
  13. print(wlan.ifconfig()) # get the interface's IP/netmask/gw/DNS addresses
  14. #ap = network.WLAN(network.AP_IF) # create access-point interface
  15. #ap.config(ssid='ESP-AP') # set the SSID of the access point
  16. #ap.config(max_clients=10) # set how many clients can connect to the network
  17. #ap.active(True) # activate the interface