-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_pico.py
More file actions
37 lines (31 loc) · 733 Bytes
/
Copy pathsetup_pico.py
File metadata and controls
37 lines (31 loc) · 733 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
# -*- coding: utf-8 -*-
"""Setup Pico
connecting to wifi
install needed libraries
disconnect wifi
you need first transfer config.py to pico
"""
from time import sleep
import network
import config
import mip
# Connecting to Wifi
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(config.wifissid, config.wifipassword)
while not wlan.isconnected() and wlan.status() >= 0:
print("Waiting to connect:")
sleep(1)
print(wlan.ifconfig())
print(wlan.isconnected())
# Install Libraries
mip.install('umqtt.simple')
sleep(1)
mip.install('logging')
sleep(1)
# Disconnect Wifi
wlan.disconnect()
wlan.active(False)
wlan.deinit()
print(" Wifi State:", wlan.status())
print("Wifi connected:", wlan.isconnected())