Browse Source

Wifi wrapper

master
Elis Hirwing 2 years ago
parent
commit
f7a5675bb3
Signed by: etu GPG Key ID: D57EFA625C9A925F
  1. 3
      Makefile
  2. 15
      src/wifi.py

3
Makefile

@ -1,9 +1,10 @@
DEVICE := /dev/ttyUSB3
copy:
ampy --port $(DEVICE) put src/pinouts.py
ampy --port $(DEVICE) put src/csms12.py
ampy --port $(DEVICE) put src/main.py
ampy --port $(DEVICE) put src/pinouts.py
ampy --port $(DEVICE) put src/wifi.py
connect:
picocom $(DEVICE) -b115200

15
src/wifi.py

@ -0,0 +1,15 @@
import network
def connect():
sta_if = network.WLAN(network.STA_IF)
if not sta_if.isconnected():
print('connecting to network...')
sta_if.active(True)
sta_if.connect('<ssid>', '<psk>')
while not sta_if.isconnected():
pass
print('network config:', sta_if.ifconfig())
Loading…
Cancel
Save