-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathboot.py
More file actions
42 lines (28 loc) · 766 Bytes
/
boot.py
File metadata and controls
42 lines (28 loc) · 766 Bytes
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
33
34
35
36
37
38
39
40
41
import gc
import webrepl
webrepl.start()
gc.collect()
import network
import time
sta_if = network.WLAN(network.STA_IF); sta_if.active(True)
try:
with open("passwords.txt") as f:
connections = f.readlines()
except OSError:
print("No passwords.txt file!")
connections = []
for connection in connections:
station, password = connection.split()
print("Connecting to {}.".format(station))
sta_if.connect(station, password)
for i in range(15):
print(".")
if sta_if.isconnected():
break
time.sleep(1)
if sta_if.isconnected():
break
else:
print("Connection could not be made.\n")
if sta_if.isconnected():
print("Connected as: {}".format(sta_if.ifconfig()[0]))