ESP-32 config wifi in micropython

Make a file with the name with the following code:

def do_connect():
    import network
    sta_if = network.WLAN(network.STA_IF)
    if not sta_if.isconnected():
        print('connecting to network...')
        sta_if.connect('essd', 'password')
        while not sta_if.isconnected():
        print('network config:', sta_if.ifconfig())

Edit to:

import ConnectWifi

Upload both files with ampy to the esp-32

ampy -p /dev/ttyUSB0 put
ampy -p /dev/ttyUSB0 put

Now when your micropython device boots up it will connect immediately connect to the configured wifi-network.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.