-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboot.py
More file actions
34 lines (28 loc) · 701 Bytes
/
boot.py
File metadata and controls
34 lines (28 loc) · 701 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
import time
import ubinascii
import machine
import micropython
import network
import esp
import credentials
esp.osdebug(None)
import gc
gc.collect()
ssid = credentials.ssid
password = credentials.password
mqtt_server = credentials.mqtt_server
#EXAMPLE IP ADDRESS
#mqtt_server = '192.168.1.144'
client_id = ubinascii.hexlify(machine.unique_id())
topic_sub = b'sensors'
last_message = 0
message_interval = 15
counter = 0
station = network.WLAN(network.STA_IF)
station.ifconfig(('192.168.1.201', '255.255.255.0', '192.168.1.1', '192.168.1.1'))
station.active(True)
station.connect(ssid, password)
while station.isconnected() == False:
pass
print('Connection successful')
print(station.ifconfig())