-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboot.py
32 lines (27 loc) · 787 Bytes
/
boot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import network
from time import sleep
sta_if = network.WLAN(network.STA_IF)
sta_if.active(True)
ap_if = network.WLAN(network.AP_IF)
ap_if.active(True)
sta_passw = 'CHANGE ME'
sta_essid = 'CHANGE ME'
ap_essid = 'CHANGEME'
#ap_channel =int(7) #channel number here
def ap_sta():
if ap_if.active() == True:
if sta_if.active() == True:
sta_if.connect(sta_essid, sta_passw)
print('Connecting Please Wait ...')
sleep(5)
while True:
if sta_if.isconnected():
ap_if.config(essid=ap_essid)
#ap_if.config(channel=ap_channel)
print('AP SSID & Channel Updated!')
print('STA ifconfig:', sta_if.ifconfig())
print('AP_ifconfig:', ap_if.ifconfig())
break
else:
sleep(5)
ap_sta()