Page 1 of 1

boot.py static ip configuration

Posted: Wed Jan 25, 2017 10:17 pm
by blckpstv
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?

Re: boot.py static ip configuration

Posted: Thu Jan 26, 2017 12:50 pm
by SpotlightKid
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