-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboot.py
42 lines (34 loc) · 765 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
35
36
37
38
39
40
41
42
try:
import usocket as socket
except:
import socket
from machine import Pin
import network
import esp
esp.osdebug(None)
import gc
gc.collect()
access_point = False
station = None
if access_point:
#Access point
ssid = 'xxx'
password = 'yyy'
station = network.WLAN(network.AP_IF)
station.active(True)
station.config(essid=ssid, password=password)
while not station.active():
print("access point not active")
pass
else:
#Connect to router
ssid = 'xxx'
password = 'yyy'
station = network.WLAN(network.STA_IF)
station.active(True)
station.connect(ssid, password)
while not station.isconnected():
pass
print('Connection successful')
print(station.ifconfig())
led = Pin(5, Pin.OUT)