MicroPython stuff
This commit is contained in:
21
code/MicroPython/network_ap.py
Normal file
21
code/MicroPython/network_ap.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import time
|
||||
import network
|
||||
|
||||
|
||||
def connect(essid='ESP', clients=3) -> bool:
|
||||
print('Starting AP: {0}...'.format(essid))
|
||||
ap = network.WLAN(network.AP_IF)
|
||||
ap.active(True)
|
||||
ap.config(essid=essid)
|
||||
ap.config(max_clients=clients)
|
||||
|
||||
time.sleep(3)
|
||||
|
||||
if ap.isconnected():
|
||||
print('AP "{0}" started'.format(essid))
|
||||
|
||||
return True
|
||||
else:
|
||||
print('Starting AP failed!')
|
||||
|
||||
return False
|
||||
Reference in New Issue
Block a user