WLAN.ifconfig(
-
- Posts: 40
- Joined: Fri Jul 26, 2019 9:40 pm
WLAN.ifconfig(
It seems that setting the IP address of a Sta isn't available for the esp32 variant:
both variants of the syntax on the Micropython reference documentation (quick reference guide etc) raise errors
wlan.ifconfig(('192.168.1.144','255.255.255.0','192.168.1,254','192.168,1,254'))
wlan.ifconfig(config=('192.168.1.144','255.255.255.0','192.168.1,254','192.168,1,254'))
'ValueError: invalid arguments'
Am I correct that this is not available for Esp32, yet documentation implies that it does.
both variants of the syntax on the Micropython reference documentation (quick reference guide etc) raise errors
wlan.ifconfig(('192.168.1.144','255.255.255.0','192.168.1,254','192.168,1,254'))
wlan.ifconfig(config=('192.168.1.144','255.255.255.0','192.168.1,254','192.168,1,254'))
'ValueError: invalid arguments'
Am I correct that this is not available for Esp32, yet documentation implies that it does.
Re: WLAN.ifconfig(
Try:
Double brackets
Code: Select all
sta_if.ifconfig(('192.168.10.99', '255.255.255.0', '192.168.10.1', '192.168.10.1'))
-
- Posts: 40
- Joined: Fri Jul 26, 2019 9:40 pm
Re: WLAN.ifconfig(
Isn't that identical to what I'm doing with merely a different instansiation of the wlan object name?
Re: WLAN.ifconfig(
Sorry, I don't know the reason ... I saw it somewhere when I had the same problem and it fixed it. I recall it has something to do with tuples.
-
- Posts: 40
- Joined: Fri Jul 26, 2019 9:40 pm
Re: WLAN.ifconfig(
Very odd. Looks identical
Re: WLAN.ifconfig(
In your example, you have commas instead of dots inside the last two addresses.RobinMosedale wrote: ↑Thu Feb 25, 2021 12:54 amIsn't that identical to what I'm doing with merely a different instansiation of the wlan object name?
Code: Select all
wlan.ifconfig(('192.168.1.144','255.255.255.0','192.168.1,254','192.168,1,254'))
^ ^ ^
-
- Posts: 40
- Joined: Fri Jul 26, 2019 9:40 pm
Re: WLAN.ifconfig(
Forgive me Jimmo. I thought that I'd corrected those:-
However the alternative syntax doesn't work, but doesn't matter.
Result:-
MicroPython v1.13-178-g21c293fbc-dirty on 2020-11-27; Camera Module (i2s) with ESP32
Type "help()" for more information.
>>> import connect_ip2
True
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "connect_ip2.py", line 6, in <module>
TypeError: function doesn't take keyword arguments
>>>
Robin
However the alternative syntax doesn't work, but doesn't matter.
Code: Select all
import network
wlan = network.WLAN(network.STA_IF)
print(wlan.active(True))
wlan.config(dhcp_hostname='esp32cam')
wlan.ifconfig(config=('192.168.1.144','255.255.255.0','192.168.1,254','192.168,1,254'))
wlan.connect("TP-LINK_EB850C","ju87bstuka")
print("Connected ",wlan.isconnected())
print(wlan.ifconfig())
MicroPython v1.13-178-g21c293fbc-dirty on 2020-11-27; Camera Module (i2s) with ESP32
Type "help()" for more information.
>>> import connect_ip2
True
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "connect_ip2.py", line 6, in <module>
TypeError: function doesn't take keyword arguments
>>>
Robin
Re: WLAN.ifconfig(
ifconfig doesn't take keyword argument.RobinMosedale wrote: ↑Thu Feb 25, 2021 3:29 pmFile "connect_ip2.py", line 6, in <module>
TypeError: function doesn't take keyword arguments
You have
Code: Select all
wlan.ifconfig(config=('192.168.1.144','255.255.255.0','192.168.1,254','192.168,1,254'))
Code: Select all
wlan.ifconfig(('192.168.1.144','255.255.255.0','192.168.1.254','192.168.1.254'))
It's clearer if you write it as
Code: Select all
ip_config = ('192.168.1.144','255.255.255.0','192.168.1.254','192.168.1.254')
wlan.ifconfig(ip_config)