Code: Select all
def enable_wifi(ssid, password):
""" Enable device as WiFi access point
Parameters
----------
ssid : String
Broadcast WiFi SSID
password: String
WiFi password
"""
if not NetworkHandler.ap:
NetworkHandler.ap = network.WLAN(network.AP_IF)
NetworkHandler.ap.active(0)
NetworkHandler.ap.config(essid=ssid)
NetworkHandler.ap.config(password=password)
NetworkHandler.ap.config(channel=1)
NetworkHandler.ap.config(authmode=4)
NetworkHandler.ap.active(1)
I discovered that the following code works, but then how to set the security and password of the accesspoint?
Code: Select all
if not NetworkHandler.ap:
NetworkHandler.ap = network.WLAN(network.AP_IF)
NetworkHandler.ap.active(0)
NetworkHandler.ap.config(essid=ssid, channel=1)
Help would be appreciated.