forked from g-sam/polly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboot.py
35 lines (28 loc) · 783 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
33
34
# This file is executed on every boot (including wake-boot from deepsleep)
#import esp
#esp.osdebug(None)
import gc
import webrepl
import utime as time
gc.collect()
# print('\nbooting...')
def do_connect():
import network
file = open('data.txt')
pw = file.read().strip()
file.close()
ap_if = network.WLAN(network.AP_IF)
ap_if.config(essid='Polly', password=pw)
# print('access point Polly open')
sta_if = network.WLAN(network.STA_IF)
if not sta_if.isconnected():
# print('connecting to network...')
sta_if.active(True)
sta_if.connect('Bam-net', pw)
while not sta_if.isconnected():
pass
# print('connected at:', sta_if.ifconfig())
do_connect()
webrepl.start()
time.sleep(1)
# print('Booted!')