Hi everyone
First of all I just want to say hello - I'm newbie
I feel terrible - each time I had bigger or smaller problem with my ESP8266 I was able to overcome it somehow - usually googling and finding the right solution but now really I'm stucked. I don't know how to enable again dhcp client on STA_IF when previously I set IP address, mask etc. I use 1.9.2 self compiled micropython onboard.
Can anyone help me with any hint? I believe it's trivial.
Piotr
Re-enable DHCP client
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Re-enable DHCP client
I use this script to establish a connection (adapt for your SSID and password):
You can erase memory of all WiFi connections by issuing
You'll then need to re-flash the firmware. Note that erasing flash will delete everything from the device's filesystem so make sure you have a backup.
Code: Select all
def do_connect():
import network
sta_if = network.WLAN(network.STA_IF)
ap = network.WLAN(network.AP_IF) # create access-point interface
ap.active(False) # deactivate the interface
if not sta_if.isconnected():
print('connecting to network...')
sta_if.active(True)
sta_if.connect('MY_SSID', 'MY_PASSWORD')
while not sta_if.isconnected():
pass
print('network config:', sta_if.ifconfig())
a = sta_if.config('mac')
print('MAC {:02x}:{:02x}:{:02x}:{:02x}:{:02x}'.format(a[0],a[1],a[2],a[3],a[4]))
Code: Select all
esptool.py --port /dev/ttyUSB0 erase_flash
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
-
- Posts: 2
- Joined: Fri Sep 22, 2017 7:38 am
Re: Re-enable DHCP client
Dear Peter,
Thank you - I flashed once again my esp and everything get back to normal with DHCP client
Best wishes,
Piotr
Thank you - I flashed once again my esp and everything get back to normal with DHCP client
Best wishes,
Piotr