boot.py static ip configuration

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
blckpstv
Posts: 28
Joined: Thu Dec 15, 2016 9:11 pm
Location: Belgium

boot.py static ip configuration

Post by blckpstv » Wed Jan 25, 2017 10:17 pm

I'm building a static ip configuration from the Wipy tutorial. But I'm using a WemosD1mini

when restarting I get the error.

Code: Select all

File "boot.py", line 16, in <module>
AttributeError: 'WLAN' object has no attribute 'init'
Though the Wipy code states.

Code: Select all

import machine
from network import WLAN
wlan = WLAN() # get current object, without changing the mode

if machine.reset_cause() != machine.SOFT_RESET:
    wlan.init(WLAN.STA)
    # configuration below MUST match your home router settings!!
    wlan.ifconfig(config=('192.168.178.107', '255.255.255.0', '192.168.178.1', '8.8.8.8'))

if not wlan.isconnected():
    # change the line below to match your network ssid, security and password
    wlan.connect('mywifi', auth=(WLAN.WPA2, 'mywifikey'), timeout=5000)
    while not wlan.isconnected():
        machine.idle() # save power while waiting
Do I need to change this for Wemos?

SpotlightKid
Posts: 463
Joined: Wed Apr 08, 2015 5:19 am

Re: boot.py static ip configuration

Post by SpotlightKid » Thu Jan 26, 2017 12:50 pm

The network.WLAN class has no "init" Method on the esp8266 port. Here's the documentation:

http://docs.micropython.org/en/latest/e ... ckref.html
http://docs.micropython.org/en/latest/e ... twork.html

Post Reply